From 5b30f96777693333c127b55151696dc1f098f485 Mon Sep 17 00:00:00 2001 From: KirillSerg Date: Sun, 23 Jun 2024 11:15:35 +0300 Subject: [PATCH] feat: added resize of font size of text elements --- src/assets/utilities.ts | 3 ++- src/store/store.ts | 16 ---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/assets/utilities.ts b/src/assets/utilities.ts index 19c80d3..5dbc5dc 100644 --- a/src/assets/utilities.ts +++ b/src/assets/utilities.ts @@ -252,6 +252,7 @@ export const useResizedCoordinates = ( x1: updatedX1, x2: updatedX2, points: updatedTrianglePointsArr.map(points => points.join()).join(" "), - d: "M " + pencilPointsArr.map(points => points.join(" ")).join(" L ") + d: "M " + pencilPointsArr.map(points => points.join(" ")).join(" L "), + fontSize: (updatedHeight / 1.5).toString(), }) } \ No newline at end of file diff --git a/src/store/store.ts b/src/store/store.ts index bb1a947..b0c86ad 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -322,23 +322,7 @@ export const onMouseMoveAtom = atom( const resizedCoordinates = useResizedCoordinates(selectedEl, update, selectingArea, resizeVector) set(updateElementsAtom, { ...selectedEl, - // x: updatedX, - // y: updatedY, - // width: updatedWidth, - // height: updatedHeight, - // cx: selectedEl.cx + (updateCoordinates.x - selectedEl.x) / 2, - // cy: selectedEl.cy + (updateCoordinates.y - selectedEl.y) / 2, - // rx: selectedEl.type === "ellipse" ? resizedCoordinates.rx : 0, - // ry: selectedEl.type === "ellipse" ? resizedCoordinates.ry : 0, - // x2: updateCoordinates.x, - // // left-bottom, top, right-bottom - // points: `${selectedEl.x},${updateCoordinates.y} ${selectedEl.x + ((updateCoordinates.x - selectedEl.x) / 2)},${selectedEl.y} ${updateCoordinates.x},${updateCoordinates.y}`, - // d: selectedEl.d + ` L ${updateCoordinates.x} ${updateCoordinates.y}` ...resizedCoordinates, - // fontSize: (newHeight / 1.5).toString(), // i don't know why but 1.5 is working good - - // txt - // y2: updateCoordinates.y, }) } })