arrow에 따라 축소지점 수정
This commit is contained in:
parent
031643c092
commit
eb255d5148
@ -126,20 +126,17 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
// setCanvasZoom(100)
|
// setCanvasZoom(100)
|
||||||
const arrows = canvas.getObjects().filter((obj) => obj.name === 'arrow')
|
const arrows = canvas.getObjects().filter((obj) => obj.name === 'arrow')
|
||||||
|
|
||||||
let x,y
|
let x, y
|
||||||
|
|
||||||
x = canvas.width / 2
|
x = canvas.width / 2
|
||||||
y = canvas.height / 2
|
y = canvas.height / 2
|
||||||
|
|
||||||
// 화살표가 음수 영역에 있을 경우 0,0 기준으로 50% 축소
|
// 화살표가 음수 영역에 있을 경우 0,0 기준으로 50% 축소
|
||||||
if(arrows.every((arrow) => arrow.left > 0) && arrows.every((arrow) => arrow.top > 0)) {
|
if (arrows.some((arrow) => arrow.left < 0) || arrows.some((arrow) => arrow.top < 0)) {
|
||||||
x = 0
|
x = 0
|
||||||
y = 0
|
y = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
canvas.zoomToPoint(new fabric.Point(x, y), 0.5)
|
canvas.zoomToPoint(new fabric.Point(x, y), 0.5)
|
||||||
changeFontSize('lengthText', '28')
|
changeFontSize('lengthText', '28')
|
||||||
changeFontSize('circuitNumber', '28')
|
changeFontSize('circuitNumber', '28')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user