diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index caaf4660..cbc0e51d 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -1679,7 +1679,10 @@ export function useMode() { const offsetEdges = [] polygon.edges.forEach((edge, i) => { - const offset = lines[i % lines.length].attributes.offset === 0 ? 0.1 : lines[i % lines.length].attributes.offset + const offset = + lines[i % lines.length].attributes.offset === undefined || lines[i % lines.length].attributes.offset === 0 + ? 0.1 + : lines[i % lines.length].attributes.offset const dx = edge.outwardNormal.x * offset const dy = edge.outwardNormal.y * offset offsetEdges.push(createOffsetEdge(edge, dx, dy)) @@ -1714,7 +1717,10 @@ export function useMode() { const offsetEdges = [] polygon.edges.forEach((edge, i) => { - const offset = lines[i % lines.length].attributes.offset === 0 ? 1 : lines[i % lines.length].attributes.offset + const offset = + lines[i % lines.length].attributes.offset === undefined || lines[i % lines.length].attributes.offset === 0 + ? 0.1 + : lines[i % lines.length].attributes.offset const dx = edge.inwardNormal.x * offset const dy = edge.inwardNormal.y * offset offsetEdges.push(createOffsetEdge(edge, dx, dy)) diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index c89e0c20..c2c73775 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -2257,8 +2257,7 @@ const changeHipAndGableRoof = (currentRoof, canvas, textMode) => { ridge.attributes.actualSize = calcLinePlaneSize({ x1: ridge.x1, y1: ridge.y1, x2: ridge.x2, y2: ridge.y2 }) } - const prevDegree = prevRoof.attributes.pitch > 0 ? getDegreeByChon(prevRoof.attributes.pitch) : prevRoof.attributes.degree - const nextDegree = nextRoof.attributes.pitch > 0 ? getDegreeByChon(nextRoof.attributes.pitch) : nextRoof.attributes.degree + const currentDegree = currentRoof.attributes.pitch > 0 ? getDegreeByChon(currentRoof.attributes.pitch) : currentRoof.attributes.degree const hip1 = new QLine([currentRoof.x1, currentRoof.y1, midX.plus(hipX2).toNumber(), midY.plus(hipY2).toNumber()], { parentId: roof.id, @@ -2283,7 +2282,7 @@ const changeHipAndGableRoof = (currentRoof, canvas, textMode) => { x2: midX.plus(hipX2).toNumber(), y2: midY.plus(hipY2).toNumber(), }, - prevDegree, + currentDegree, ), }, }) @@ -2318,7 +2317,7 @@ const changeHipAndGableRoof = (currentRoof, canvas, textMode) => { x2: midX.plus(hipX2).toNumber(), y2: midY.plus(hipY2).toNumber(), }, - nextDegree, + currentDegree, ), }, }) @@ -2345,7 +2344,6 @@ const changeHipAndGableRoof = (currentRoof, canvas, textMode) => { }) hipLines.forEach((hip, i) => { - const gableDegree = i === 0 ? prevDegree : nextDegree const gableLine = new QLine([hip.x2, hip.y2, currentRoof.attributes.ridgeCoordinate.x1, currentRoof.attributes.ridgeCoordinate.y1], { parentId: roof.id, fontSize: roof.fontSize, @@ -2369,7 +2367,7 @@ const changeHipAndGableRoof = (currentRoof, canvas, textMode) => { x2: currentRoof.attributes.ridgeCoordinate.x1, y2: currentRoof.attributes.ridgeCoordinate.y1, }, - gableDegree, + currentDegree, ), }, }) @@ -3433,7 +3431,10 @@ function createRoofMarginPolygon(polygon, lines, arcSegments = 0) { const offsetEdges = [] polygon.edges.forEach((edge, i) => { - const offset = lines[i % lines.length].attributes.offset + const offset = + lines[i % lines.length].attributes.offset === undefined || lines[i % lines.length].attributes.offset === 0 + ? 0.1 + : lines[i % lines.length].attributes.offset const dx = edge.outwardNormal.x * offset const dy = edge.outwardNormal.y * offset offsetEdges.push(createOffsetEdge(edge, dx, dy)) @@ -3461,7 +3462,10 @@ function createRoofPaddingPolygon(polygon, lines, arcSegments = 0) { const offsetEdges = [] polygon.edges.forEach((edge, i) => { - const offset = lines[i % lines.length].attributes.offset + const offset = + lines[i % lines.length].attributes.offset === undefined || lines[i % lines.length].attributes.offset === 0 + ? 0.1 + : lines[i % lines.length].attributes.offset const dx = edge.inwardNormal.x * offset const dy = edge.inwardNormal.y * offset offsetEdges.push(createOffsetEdge(edge, dx, dy)) @@ -3523,7 +3527,8 @@ export const inPolygon = (polygonPoints, rectPoints) => { /** * 포인트를 기준으로 선의 길이를 구한다. 선의 길이는 10을 곱하여 사용한다. - * @param points {{x1, y1, x2, y2}} + * @param points + * @returns number */ export const calcLinePlaneSize = (points) => { const { x1, y1, x2, y2 } = points