Merge branch 'dev' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
eb322f55f6
@ -828,72 +828,6 @@ export function useSurfaceShapeBatch() {
|
|||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
const surfaceShapeActualSize = () => {
|
|
||||||
const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof')
|
|
||||||
let notParallelLines = []
|
|
||||||
|
|
||||||
const roofArray = []
|
|
||||||
|
|
||||||
roofs.forEach((obj) => {
|
|
||||||
const roof = {
|
|
||||||
id: obj.id,
|
|
||||||
surfaceId: obj.surfaceId,
|
|
||||||
targetLines: [],
|
|
||||||
baseLines: [],
|
|
||||||
direction: obj.direction,
|
|
||||||
}
|
|
||||||
obj.lines.forEach((line) => {
|
|
||||||
if (obj.direction === 'north' || obj.direction === 'south') {
|
|
||||||
if (line.y1 !== line.y2) {
|
|
||||||
roof.targetLines.push(line)
|
|
||||||
} else {
|
|
||||||
roof.baseLines.push(line)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (line.x1 !== line.x2) {
|
|
||||||
roof.targetLines.push(line)
|
|
||||||
} else {
|
|
||||||
roof.baseLines.push(line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
roofArray.push(roof)
|
|
||||||
})
|
|
||||||
|
|
||||||
const slopeRadians = slope.angleValue * (Math.PI / 180)
|
|
||||||
const tanSlope = Math.tan(slopeRadians)
|
|
||||||
|
|
||||||
roofArray.forEach((roof) => {
|
|
||||||
roof.targetLines.forEach((line) => {
|
|
||||||
let calcLength = line.length
|
|
||||||
|
|
||||||
if (roof.surfaceId === 1) {
|
|
||||||
calcLength = roof.direction === 'north' || roof.direction === 'south' ? Math.abs(line.y1 - line.y2) : Math.abs(line.x1 - line.x2)
|
|
||||||
}
|
|
||||||
|
|
||||||
const h = calcLength * tanSlope
|
|
||||||
const resultLength = Math.sqrt(Math.pow(calcLength, 2) + Math.pow(h, 2))
|
|
||||||
|
|
||||||
line.set({
|
|
||||||
attributes: {
|
|
||||||
...line.attributes,
|
|
||||||
actualSize: parseInt((Math.floor(resultLength) * 10).toFixed(0)),
|
|
||||||
planeSize: parseInt(line.length * 10),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
roof.baseLines.forEach((line) => {
|
|
||||||
line.set({
|
|
||||||
attributes: {
|
|
||||||
...line.attributes,
|
|
||||||
actualSize: parseInt((Math.floor(line.length) * 10).toFixed(0)),
|
|
||||||
planeSize: parseInt(line.length * 10),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const changeSurfaceLinePropertyEvent = () => {
|
const changeSurfaceLinePropertyEvent = () => {
|
||||||
let tmpLines = []
|
let tmpLines = []
|
||||||
const roof = canvas.getActiveObject()
|
const roof = canvas.getActiveObject()
|
||||||
@ -998,7 +932,7 @@ export function useSurfaceShapeBatch() {
|
|||||||
deleteAllSurfacesAndObjects,
|
deleteAllSurfacesAndObjects,
|
||||||
moveSurfaceShapeBatch,
|
moveSurfaceShapeBatch,
|
||||||
resizeSurfaceShapeBatch,
|
resizeSurfaceShapeBatch,
|
||||||
surfaceShapeActualSize,
|
|
||||||
changeSurfaceLinePropertyEvent,
|
changeSurfaceLinePropertyEvent,
|
||||||
changeSurfaceLineProperty,
|
changeSurfaceLineProperty,
|
||||||
changeSurfaceLinePropertyReset,
|
changeSurfaceLinePropertyReset,
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export function useContextMenu() {
|
|||||||
const [column, setColumn] = useState(null)
|
const [column, setColumn] = useState(null)
|
||||||
const { handleZoomClear } = useCanvasEvent()
|
const { handleZoomClear } = useCanvasEvent()
|
||||||
const { moveObjectBatch } = useObjectBatch({})
|
const { moveObjectBatch } = useObjectBatch({})
|
||||||
const { moveSurfaceShapeBatch, surfaceShapeActualSize } = useSurfaceShapeBatch()
|
const { moveSurfaceShapeBatch } = useSurfaceShapeBatch()
|
||||||
const currentMenuSetting = () => {
|
const currentMenuSetting = () => {
|
||||||
switch (currentMenu) {
|
switch (currentMenu) {
|
||||||
case MENU.PLAN_DRAWING:
|
case MENU.PLAN_DRAWING:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user