외벽선 제거 및 경사 오류 수정
This commit is contained in:
parent
ed1d419d0c
commit
faa45a5eac
@ -199,9 +199,10 @@ export default function ContextRoofAllocationSetting(props) {
|
|||||||
type="text"
|
type="text"
|
||||||
className="input-origin block"
|
className="input-origin block"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index)
|
// handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index)
|
||||||
handleChangePitch(e, index)
|
handleChangePitch(e, index)
|
||||||
}}
|
}}
|
||||||
|
value={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||||
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -201,6 +201,7 @@ export default function RoofAllocationSetting(props) {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
handleChangePitch(e, index)
|
handleChangePitch(e, index)
|
||||||
}}
|
}}
|
||||||
|
value={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||||
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -307,5 +307,32 @@ export function useRoofFn() {
|
|||||||
return area.points.map((p) => fabric.util.transformPoint({ x: p.x - area.pathOffset.x, y: p.y - area.pathOffset.y }, area.calcTransformMatrix()))
|
return area.points.map((p) => fabric.util.transformPoint({ x: p.x - area.pathOffset.x, y: p.y - area.pathOffset.y }, area.calcTransformMatrix()))
|
||||||
}
|
}
|
||||||
|
|
||||||
return { setSurfaceShapePattern, removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial }
|
const removeOuterLines = (currentMousePos) => {
|
||||||
|
const roofBase = canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => obj.name === POLYGON_TYPE.ROOF)
|
||||||
|
.filter((roof) => roof.inPolygon(currentMousePos))
|
||||||
|
|
||||||
|
if (roofBase.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const roof = roofBase[0]
|
||||||
|
const wall = roof.wall
|
||||||
|
|
||||||
|
canvas.remove(roof)
|
||||||
|
canvas.remove(wall)
|
||||||
|
|
||||||
|
const allRoofObject = canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => /*obj !== roof && obj !== wall &&*/ obj.attributes?.roofId === roof.id || obj.parentId === roof.id || obj.parentId === wall.id)
|
||||||
|
|
||||||
|
allRoofObject.forEach((obj) => {
|
||||||
|
canvas.remove(obj)
|
||||||
|
})
|
||||||
|
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
return { setSurfaceShapePattern, removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial, removeOuterLines }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -495,7 +495,12 @@ export function useRoofAllocationSetting(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleChangePitch = (e, index) => {
|
const handleChangePitch = (e, index) => {
|
||||||
const value = e.target.value
|
let value = e.target.value
|
||||||
|
|
||||||
|
const reg = /^[0-9]+(\.[0-9]{0,1})?$/
|
||||||
|
if (!reg.test(value)) {
|
||||||
|
value = value.substring(0, value.length - 1)
|
||||||
|
}
|
||||||
const newRoofList = currentRoofList.map((roof, idx) => {
|
const newRoofList = currentRoofList.map((roof, idx) => {
|
||||||
if (idx === index) {
|
if (idx === index) {
|
||||||
const result =
|
const result =
|
||||||
|
|||||||
@ -68,7 +68,7 @@ export function useContextMenu() {
|
|||||||
const { settingsData, setSettingsDataSave } = useCanvasSetting()
|
const { settingsData, setSettingsDataSave } = useCanvasSetting()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const { alignModule, modulesRemove, moduleRoofRemove } = useModule()
|
const { alignModule, modulesRemove, moduleRoofRemove } = useModule()
|
||||||
const { removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial } = useRoofFn()
|
const { removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial, removeOuterLines } = useRoofFn()
|
||||||
|
|
||||||
const currentMenuSetting = () => {
|
const currentMenuSetting = () => {
|
||||||
switch (currentMenu) {
|
switch (currentMenu) {
|
||||||
@ -150,7 +150,9 @@ export function useContextMenu() {
|
|||||||
{
|
{
|
||||||
id: 'wallLineRemove',
|
id: 'wallLineRemove',
|
||||||
name: getMessage('contextmenu.wallline.remove'),
|
name: getMessage('contextmenu.wallline.remove'),
|
||||||
fn: () => deleteOuterLineObject(),
|
fn: (currentMousePos) => {
|
||||||
|
removeOuterLines(currentMousePos)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user