셀 도머영역 제외 처리
This commit is contained in:
parent
7b6f5709d4
commit
4857c31d5a
@ -4865,6 +4865,8 @@ export function useMode() {
|
||||
const drawCellManualInTrestle = () => {
|
||||
const trestlePolygons = canvas?.getObjects().filter((obj) => obj.name === 'trestle') //가대를 가져옴
|
||||
|
||||
const dormerTrestlePolygons = canvas?.getObjects().filter((obj) => obj.name === 'dormerTrestle') //도머 객체
|
||||
|
||||
if (trestlePolygons.length !== 0) {
|
||||
let fabricPolygon = null
|
||||
let inside = false
|
||||
@ -5060,22 +5062,39 @@ export function useMode() {
|
||||
})
|
||||
|
||||
canvas?.on('mouse:up', (e) => {
|
||||
let isIntersection = true
|
||||
if (!inside) return
|
||||
if (fabricPolygon) {
|
||||
const rectPoints = [
|
||||
{ x: fabricPolygon.left + 0.1, y: fabricPolygon.top + 0.1 },
|
||||
{ x: fabricPolygon.left + 0.1 + fabricPolygon.width * fabricPolygon.scaleX, y: fabricPolygon.top + 0.1 },
|
||||
{ x: fabricPolygon.left + 0.5, y: fabricPolygon.top + 0.5 },
|
||||
{ x: fabricPolygon.left + 0.5 + fabricPolygon.width * fabricPolygon.scaleX, y: fabricPolygon.top + 0.5 },
|
||||
{
|
||||
x: fabricPolygon.left + fabricPolygon.width * fabricPolygon.scaleX + 0.1,
|
||||
y: fabricPolygon.top + fabricPolygon.height * fabricPolygon.scaleY + 0.1,
|
||||
x: fabricPolygon.left + fabricPolygon.width * fabricPolygon.scaleX + 0.5,
|
||||
y: fabricPolygon.top + fabricPolygon.height * fabricPolygon.scaleY + 0.5,
|
||||
},
|
||||
{ x: fabricPolygon.left + 0.1, y: fabricPolygon.top + fabricPolygon.height * fabricPolygon.scaleY + 0.1 },
|
||||
{ x: fabricPolygon.left + 0.5, y: fabricPolygon.top + fabricPolygon.height * fabricPolygon.scaleY + 0.5 },
|
||||
]
|
||||
|
||||
fabricPolygon.set({ points: rectPoints })
|
||||
const tempTurfModule = polygonToTurfPolygon(fabricPolygon)
|
||||
|
||||
if (dormerTrestlePolygons) {
|
||||
dormerTrestlePolygons.forEach((dormerTrestle) => {
|
||||
const dormerTurfPolygon = polygonToTurfPolygon(dormerTrestle)
|
||||
|
||||
const intersection = turf.intersect(turf.featureCollection([dormerTurfPolygon, tempTurfModule]))
|
||||
|
||||
if (intersection) {
|
||||
alert('도머위에 모듈을 올릴 수 없습니다.')
|
||||
isIntersection = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!isIntersection) return
|
||||
|
||||
fabricPolygon.setCoords() //좌표 재정렬
|
||||
|
||||
if (turf.booleanWithin(tempTurfModule, turfPolygon)) {
|
||||
//마우스 클릭시 set으로 해당 위치에 셀을 넣음
|
||||
|
||||
@ -5164,8 +5183,6 @@ export function useMode() {
|
||||
const cols = Math.floor((bbox[2] - bbox[0]) / width)
|
||||
const rows = Math.floor((bbox[3] - bbox[1]) / height)
|
||||
|
||||
// console.log('bbox', bbox)
|
||||
|
||||
for (let col = 0; col <= cols; col++) {
|
||||
for (let row = 0; row <= rows; row++) {
|
||||
let x = 0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user