Merge branch 'dev' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
9ecfcb1f53
@ -4865,6 +4865,8 @@ export function useMode() {
|
|||||||
const drawCellManualInTrestle = () => {
|
const drawCellManualInTrestle = () => {
|
||||||
const trestlePolygons = canvas?.getObjects().filter((obj) => obj.name === 'trestle') //가대를 가져옴
|
const trestlePolygons = canvas?.getObjects().filter((obj) => obj.name === 'trestle') //가대를 가져옴
|
||||||
|
|
||||||
|
const dormerTrestlePolygons = canvas?.getObjects().filter((obj) => obj.name === 'dormerTrestle') //도머 객체
|
||||||
|
|
||||||
if (trestlePolygons.length !== 0) {
|
if (trestlePolygons.length !== 0) {
|
||||||
let fabricPolygon = null
|
let fabricPolygon = null
|
||||||
let inside = false
|
let inside = false
|
||||||
@ -5060,22 +5062,39 @@ export function useMode() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
canvas?.on('mouse:up', (e) => {
|
canvas?.on('mouse:up', (e) => {
|
||||||
|
let isIntersection = true
|
||||||
if (!inside) return
|
if (!inside) return
|
||||||
if (fabricPolygon) {
|
if (fabricPolygon) {
|
||||||
const rectPoints = [
|
const rectPoints = [
|
||||||
{ x: fabricPolygon.left + 0.1, y: fabricPolygon.top + 0.1 },
|
{ x: fabricPolygon.left + 0.5, y: fabricPolygon.top + 0.5 },
|
||||||
{ x: fabricPolygon.left + 0.1 + fabricPolygon.width * fabricPolygon.scaleX, y: fabricPolygon.top + 0.1 },
|
{ x: fabricPolygon.left + 0.5 + fabricPolygon.width * fabricPolygon.scaleX, y: fabricPolygon.top + 0.5 },
|
||||||
{
|
{
|
||||||
x: fabricPolygon.left + fabricPolygon.width * fabricPolygon.scaleX + 0.1,
|
x: fabricPolygon.left + fabricPolygon.width * fabricPolygon.scaleX + 0.5,
|
||||||
y: fabricPolygon.top + fabricPolygon.height * fabricPolygon.scaleY + 0.1,
|
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 })
|
fabricPolygon.set({ points: rectPoints })
|
||||||
const tempTurfModule = polygonToTurfPolygon(fabricPolygon)
|
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() //좌표 재정렬
|
fabricPolygon.setCoords() //좌표 재정렬
|
||||||
|
|
||||||
if (turf.booleanWithin(tempTurfModule, turfPolygon)) {
|
if (turf.booleanWithin(tempTurfModule, turfPolygon)) {
|
||||||
//마우스 클릭시 set으로 해당 위치에 셀을 넣음
|
//마우스 클릭시 set으로 해당 위치에 셀을 넣음
|
||||||
|
|
||||||
@ -5164,8 +5183,6 @@ export function useMode() {
|
|||||||
const cols = Math.floor((bbox[2] - bbox[0]) / width)
|
const cols = Math.floor((bbox[2] - bbox[0]) / width)
|
||||||
const rows = Math.floor((bbox[3] - bbox[1]) / height)
|
const rows = Math.floor((bbox[3] - bbox[1]) / height)
|
||||||
|
|
||||||
// console.log('bbox', bbox)
|
|
||||||
|
|
||||||
for (let col = 0; col <= cols; col++) {
|
for (let col = 0; col <= cols; col++) {
|
||||||
for (let row = 0; row <= rows; row++) {
|
for (let row = 0; row <= rows; row++) {
|
||||||
let x = 0,
|
let x = 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user