사이즈 변경 시 1. 왼쪽 위 고정, 2. 오른쪽 아래 고정

This commit is contained in:
hyojun.choi 2026-06-22 15:19:20 +09:00
parent 58fbb34c74
commit ad5fa31576

View File

@ -88,15 +88,26 @@ export default function AuxiliarySize(props) {
// . // .
const scaleFactor = Big(size).div(distance) const scaleFactor = Big(size).div(distance)
//1 2 , 2 1 . // [SIZE-ANCHOR 2026-06-22] x1/x2 ( 1 , 1 )
// . 1= , 2= .
// ( useWallLineOffsetSetting "1=down/right, 2=up/left" )
// (x ) , 1( ) .
const VERTICAL_EPS = 1 // (10mm) x
const p1IsTopLeft = Math.abs(x1 - x2) > VERTICAL_EPS ? x1 < x2 : y1 <= y2
const topLeft = p1IsTopLeft ? { x: x1, y: y1 } : { x: x2, y: y2 }
const bottomRight = p1IsTopLeft ? { x: x2, y: y2 } : { x: x1, y: y1 }
//1( ) (down/right). 2( ) (up/left).
if (checkedRadio === 1) { if (checkedRadio === 1) {
const newX2 = Big(x1).plus(dx.times(scaleFactor)).toNumber() const newBrX = Big(topLeft.x).plus(Big(bottomRight.x).minus(topLeft.x).times(scaleFactor)).toNumber()
const newY2 = Big(y1).plus(dy.times(scaleFactor)).toNumber() const newBrY = Big(topLeft.y).plus(Big(bottomRight.y).minus(topLeft.y).times(scaleFactor)).toNumber()
currentObject.set({ x2: newX2, y2: newY2 }) if (p1IsTopLeft) currentObject.set({ x2: newBrX, y2: newBrY })
else currentObject.set({ x1: newBrX, y1: newBrY })
} else if (checkedRadio === 2) { } else if (checkedRadio === 2) {
const newX1 = Big(x2).minus(dx.times(scaleFactor)).toNumber() const newTlX = Big(bottomRight.x).plus(Big(topLeft.x).minus(bottomRight.x).times(scaleFactor)).toNumber()
const newY1 = Big(y2).minus(dy.times(scaleFactor)).toNumber() const newTlY = Big(bottomRight.y).plus(Big(topLeft.y).minus(bottomRight.y).times(scaleFactor)).toNumber()
currentObject.set({ x1: newX1, y1: newY1 }) if (p1IsTopLeft) currentObject.set({ x1: newTlX, y1: newTlY })
else currentObject.set({ x2: newTlX, y2: newTlY })
} }
//planeSize actualSize . //planeSize actualSize .
currentObject.attributes.planeSize = calcLinePlaneSize({ currentObject.attributes.planeSize = calcLinePlaneSize({