Skip to content

Commit

Permalink
feat: added resize of font size of text elements
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillSerg committed Jun 23, 2024
1 parent a264c86 commit 5b30f96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/assets/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
}
16 changes: 0 additions & 16 deletions src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
})
Expand Down

0 comments on commit 5b30f96

Please sign in to comment.