확대 축소 시 mouseLine 작아지는 현상 수정

This commit is contained in:
hyojun.choi 2024-09-19 18:21:07 +09:00
parent 337bd4fc4b
commit c766428630

View File

@ -37,7 +37,7 @@ export function useEvent() {
if (zoom > 5) zoom = 5
if (zoom < 0.5) zoom = 0.5
setCanvasZoom((zoom * 100).toFixed(0))
setCanvasZoom(Number((zoom * 100).toFixed(0)))
// 마우스 위치 기준으로 확대/축소
canvas.zoomToPoint({ x: opt.e.offsetX, y: opt.e.offsetY }, zoom)
@ -55,7 +55,7 @@ export function useEvent() {
removeMouseLine()
// 가로선
const pointer = canvas.getPointer(e.e)
const horizontalLine = new fabric.Line([0, pointer.y, 2 * canvas.width, pointer.y], {
const horizontalLine = new fabric.Line([-1 * canvas.width, pointer.y, 2 * canvas.width, pointer.y], {
stroke: 'red',
strokeWidth: 1,
selectable: false,
@ -63,7 +63,7 @@ export function useEvent() {
})
// 세로선
const verticalLine = new fabric.Line([pointer.x, 0, pointer.x, 2 * canvas.height], {
const verticalLine = new fabric.Line([pointer.x, -1 * canvas.height, pointer.x, 2 * canvas.height], {
stroke: 'red',
strokeWidth: 1,
selectable: false,