group에 추가

This commit is contained in:
hyojun.choi 2024-07-22 12:00:00 +09:00
parent 8089caafdf
commit 3b9abe4bb3

View File

@ -115,7 +115,7 @@ export default class QPolygon extends fabric.Group {
} }
}) })
this.canvas.add() this.addWithUpdate()
} }
addLengthText() { addLengthText() {
@ -144,7 +144,7 @@ export default class QPolygon extends fabric.Group {
}) })
this.texts.push(text) this.texts.push(text)
this.canvas.add(text) this.addWithUpdate(text)
}) })
this.canvas.renderAll() this.canvas.renderAll()
@ -199,7 +199,7 @@ export default class QPolygon extends fabric.Group {
const isInside = rectPoints.every((rectPoint) => this.inPolygon(rectPoint) && this.distanceFromEdge(rectPoint) >= cell.padding) const isInside = rectPoints.every((rectPoint) => this.inPolygon(rectPoint) && this.distanceFromEdge(rectPoint) >= cell.padding)
if (isInside) { if (isInside) {
this.canvas.add(rect) this.addWithUpdate(rect)
} }
} }
} }
@ -523,12 +523,12 @@ export default class QPolygon extends fabric.Group {
strokeWidth: 1, strokeWidth: 1,
}) })
this.canvas.add(realLine1) this.addWithUpdate(realLine1)
this.canvas.add(realLine2) this.addWithUpdate(realLine2)
this.canvas.add(realLine3) this.addWithUpdate(realLine3)
this.canvas.add(realLine4) this.addWithUpdate(realLine4)
this.canvas.add(realLine5) this.addWithUpdate(realLine5)
this.canvas.add(realLine6) this.addWithUpdate(realLine6)
if (smallestLength !== maxLength) { if (smallestLength !== maxLength) {
// 정사각형이 아닌경우에만 용마루를 추가한다. // 정사각형이 아닌경우에만 용마루를 추가한다.
this.canvas.add(ridge) this.canvas.add(ridge)
@ -593,7 +593,7 @@ export default class QPolygon extends fabric.Group {
direction: 'horizontal', direction: 'horizontal',
}) })
// this.canvas.add(centerLine) // this.addWithUpdate(centerLine)
centerLines.push(centerLine) centerLines.push(centerLine)
}) })
@ -618,7 +618,7 @@ export default class QPolygon extends fabric.Group {
strokeWidth: 1, strokeWidth: 1,
direction: 'vertical', direction: 'vertical',
}) })
// this.canvas.add(centerLine) // this.addWithUpdate(centerLine)
centerLines.push(centerLine) centerLines.push(centerLine)
}) })
@ -646,7 +646,7 @@ export default class QPolygon extends fabric.Group {
stroke: 'green', stroke: 'green',
idx: index, idx: index,
}) })
this.canvas.add(line) this.addWithUpdate(line)
helpLines.push(line) helpLines.push(line)
this.canvas.renderAll() this.canvas.renderAll()
}) })
@ -677,10 +677,10 @@ export default class QPolygon extends fabric.Group {
}) })
ridgeStartPoints.push(intersectionPoint) ridgeStartPoints.push(intersectionPoint)
this.canvas.add(helpLine1) this.addWithUpdate(helpLine1)
this.canvas.add(helpLine2) this.addWithUpdate(helpLine2)
this.canvas.remove(nextLine) this.removeWithUpdate(nextLine)
this.canvas.remove(line) this.removeWithUpdate(line)
this.canvas.renderAll() this.canvas.renderAll()
}) })
@ -731,9 +731,9 @@ export default class QPolygon extends fabric.Group {
}) })
ridgeEndPoints.push(arrivalPoint) ridgeEndPoints.push(arrivalPoint)
this.canvas.add(ridge) this.addWithUpdate(ridge)
this.canvas.add(helpLine) this.addWithUpdate(helpLine)
this.canvas.remove(line) this.removeWithUpdate(line)
this.canvas.renderAll() this.canvas.renderAll()
} }
}) })
@ -746,7 +746,7 @@ export default class QPolygon extends fabric.Group {
stroke: 'green', stroke: 'green',
}) })
this.canvas.add(ridgeConnectLine) this.addWithUpdate(ridgeConnectLine)
this.canvas.renderAll() this.canvas.renderAll()
}) })
} }
@ -778,7 +778,7 @@ export default class QPolygon extends fabric.Group {
idx: index, idx: index,
}) })
historyLines.push(line) historyLines.push(line)
this.canvas.add(line) this.addWithUpdate(line)
this.canvas.renderAll() this.canvas.renderAll()
}) })
@ -808,10 +808,10 @@ export default class QPolygon extends fabric.Group {
notInterSectionLines.pop() notInterSectionLines.pop()
helpPoints.push(intersectionPoint) helpPoints.push(intersectionPoint)
this.canvas.add(helpLine1) this.addWithUpdate(helpLine1)
this.canvas.add(helpLine2) this.addWithUpdate(helpLine2)
this.canvas.remove(prevLine) this.removeWithUpdate(prevLine)
this.canvas.remove(line) this.removeWithUpdate(line)
this.canvas.renderAll() this.canvas.renderAll()
}) })
// 용마루 // 용마루
@ -868,11 +868,11 @@ export default class QPolygon extends fabric.Group {
strokeWidth: 5, strokeWidth: 5,
}) })
this.canvas.add(ridge) this.addWithUpdate(ridge)
this.canvas.renderAll() this.canvas.renderAll()
this.canvas.add(ridgeHelpLine) this.addWithUpdate(ridgeHelpLine)
this.canvas.remove(closestLine) this.removeWithUpdate(closestLine)
this.canvas.renderAll() this.canvas.renderAll()
}) })
@ -885,7 +885,7 @@ export default class QPolygon extends fabric.Group {
stroke: 'green', stroke: 'green',
strokeWidth: 5, strokeWidth: 5,
}) })
this.canvas.add(ridgeConnectLine) this.addWithUpdate(ridgeConnectLine)
this.canvas.renderAll() this.canvas.renderAll()
} }