Compare commits

..

No commits in common. "a175144b2cb24f99eda32e10b46b53d4723f2b24" and "5065999f80c2daba12364da4d78f947b572e98bf" have entirely different histories.

3 changed files with 11 additions and 9 deletions

View File

@ -68,10 +68,9 @@ export default function CanvasFrame() {
canvas?.loadFromJSON(JSON.parse(plan.canvasStatus), function () { canvas?.loadFromJSON(JSON.parse(plan.canvasStatus), function () {
canvasLoadInit() //config canvasLoadInit() //config
canvas?.renderAll() // . canvas?.renderAll() // .
if (canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE).length > 0) { if (canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE).length > 0) {
setSelectedMenu('module') setSelectedMenu('module')
} else if (canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL).length > 0) {
setSelectedMenu('outline')
} else { } else {
setSelectedMenu('surface') setSelectedMenu('surface')
} }

View File

@ -202,7 +202,7 @@ export function useRoofFn() {
} }
const roof = roofBase[0] const roof = roofBase[0]
const wall = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.WALL && obj.attributes?.roofId === roof.id) const wall = roof.wall
const checkPolygon = new fabric.Polygon(roof.points, { const checkPolygon = new fabric.Polygon(roof.points, {
name: 'moveRoofPolygon', name: 'moveRoofPolygon',
@ -230,11 +230,16 @@ export function useRoofFn() {
const texts = canvas.getObjects().filter((obj) => obj.type === 'text' && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id)) const texts = canvas.getObjects().filter((obj) => obj.type === 'text' && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id))
texts.forEach((text) => canvas.remove(text)) texts.forEach((text) => canvas.remove(text))
const outerLines = canvas.getObjects().filter((obj) => obj.type === 'QLine' && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id))
const allRoofObject = canvas const allRoofObject = canvas
.getObjects() .getObjects()
.filter((obj) => obj !== roof && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id || obj.parentId === wall.id)) .filter(
(obj) => obj !== roof && /*obj !== wall &&*/ (obj.attributes?.roofId === roof.id || obj.parentId === roof.id || obj.parentId === wall.id),
)
// // Calculate the movement delta
/** 지붕이 움직인 만큼의 delta를 구한다. */
const originalRoofLeft = roof.left const originalRoofLeft = roof.left
const originalRoofTop = roof.top const originalRoofTop = roof.top

View File

@ -7585,8 +7585,6 @@ const reDrawPolygon = (polygon, canvas) => {
selectable: polygon.selectable, selectable: polygon.selectable,
fontSize: polygon.fontSize, fontSize: polygon.fontSize,
wall: polygon.wall !== undefined ? polygon.wall : null, wall: polygon.wall !== undefined ? polygon.wall : null,
originX: polygon.originX,
originY: polygon.originY,
}) })
const newLines = newPolygon.lines const newLines = newPolygon.lines
@ -7611,8 +7609,8 @@ const reDrawPolygon = (polygon, canvas) => {
} }
}) })
canvas.add(newPolygon) canvas?.add(newPolygon)
canvas.renderAll() canvas?.renderAll()
return newPolygon return newPolygon
} }