text component
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useState, useRef, useEffect } from "react";
|
||||
import Konva from "konva";
|
||||
import { useEditorStore, type EditorObject } from "@/pages/editor/store/editorStore";
|
||||
import { useTextDefaultsStore } from "@/pages/editor/store/textDefaultsStore";
|
||||
import { createDrawingObject } from "./drawingUtils";
|
||||
|
||||
export const useDrawingHandlers = () => {
|
||||
@@ -10,6 +11,7 @@ export const useDrawingHandlers = () => {
|
||||
const transformerRef = useRef<Konva.Transformer>(null);
|
||||
|
||||
const { tool, addObject, updateObject, setSelectedObjectId, selectedObjectId } = useEditorStore();
|
||||
const { defaults } = useTextDefaultsStore();
|
||||
|
||||
useEffect(() => {
|
||||
setTempObject(null);
|
||||
@@ -59,8 +61,13 @@ export const useDrawingHandlers = () => {
|
||||
x: pointerPos.x,
|
||||
y: pointerPos.y,
|
||||
text: "متن جدید",
|
||||
fontSize: 24,
|
||||
fill: "#000000",
|
||||
fontSize: defaults.fontSize,
|
||||
fontFamily: defaults.fontFamily,
|
||||
fontWeight: defaults.fontWeight,
|
||||
fill: defaults.fill,
|
||||
opacity: defaults.opacity,
|
||||
letterSpacing: defaults.letterSpacing,
|
||||
wordSpacing: defaults.wordSpacing,
|
||||
};
|
||||
addObject(newText);
|
||||
setSelectedObjectId(newText.id);
|
||||
|
||||
Reference in New Issue
Block a user