Compare commits

..

No commits in common. "1276230fcce129e8eee403a84728e4c7a5614787" and "a41092b89673c3c5c867fdfc6472d43f20f63ffb" have entirely different histories.

View File

@ -2287,21 +2287,17 @@ export const useTrestle = () => {
const { width: currentWidth, height: currentHeight, moduleInfo: currentModuleInfo } = m1 const { width: currentWidth, height: currentHeight, moduleInfo: currentModuleInfo } = m1
const { width: neighborWidth, height: neighborHeight, moduleInfo: neighborModuleInfo } = m2 const { width: neighborWidth, height: neighborHeight, moduleInfo: neighborModuleInfo } = m2
const maxWidth = Math.max(currentWidth, neighborWidth)
const maxHeight = Math.max(currentHeight, neighborHeight)
const { moduleTpCd: currentModuleTpCd } = currentModuleInfo const { moduleTpCd: currentModuleTpCd } = currentModuleInfo
const { moduleTpCd: neighborModuleTpCd } = neighborModuleInfo const { moduleTpCd: neighborModuleTpCd } = neighborModuleInfo
const { x: m1X, y: m1Y } = m1.getCenterPoint() const { x: m1X, y: m1Y } = m1.getCenterPoint()
const { x: m2X, y: m2Y } = m2.getCenterPoint() const { x: m2X, y: m2Y } = m2.getCenterPoint()
sizes.push({ width: currentWidth, height: currentHeight }) sizes.push({ width: currentWidth, height: currentHeight })
if (currentModuleTpCd !== neighborModuleTpCd) { if (currentModuleTpCd !== neighborModuleTpCd) {
sizes.push({ width: neighborWidth, height: neighborHeight }) sizes.push({ width: neighborWidth, height: neighborHeight })
} }
/*
m1.set({ fill: m1Fill }) /*m1.set({ fill: m1Fill })
m2.set({ fill: m2Fill }) m2.set({ fill: m2Fill })
canvas.renderAll()*/ canvas.renderAll()*/
@ -2335,13 +2331,13 @@ export const useTrestle = () => {
// console.log(maxX, maxY, halfMaxX, halfMaxY) // console.log(maxX, maxY, halfMaxX, halfMaxY)
if (Math.abs(m1X - m2X) < 1) { if (Math.abs(m1X - m2X) < 1) {
return Math.abs(Math.abs(m1Y - m2Y) - maxY) < 1 || Math.abs(m2Y - m1Y) <= halfMaxY return Math.abs(Math.abs(m1Y - m2Y) - maxY) < 1
} else if (Math.abs(m1Y - m2Y) < 1) { } else if (Math.abs(m1Y - m2Y) < 1) {
return Math.abs(Math.abs(m1X - m2X) - maxX) < 1 || Math.abs(m2X - m1X) <= halfMaxX return Math.abs(Math.abs(m1X - m2X) - maxX) < 1
} }
return ( return (
(Math.abs(m1X - m2X) < maxX - moduleIntvlHor / 10 + 1 && Math.abs(m1Y - m2Y) < maxY - moduleIntvlVer / 10) || (Math.abs(m1X - m2X) < maxX - moduleIntvlHor / 10 && Math.abs(m1Y - m2Y) < maxY - moduleIntvlVer / 10) ||
(Math.abs(Math.abs(m1X - m2X) - maxX / 2) < halfMaxX + 1 && Math.abs(Math.abs(m1Y - m2Y) - maxY) < halfMaxY + 1) || (Math.abs(Math.abs(m1X - m2X) - maxX / 2) < halfMaxX + 1 && Math.abs(Math.abs(m1Y - m2Y) - maxY) < halfMaxY + 1) ||
(Math.abs(Math.abs(m1X - m2X) - maxX) < halfMaxX + 1 && Math.abs(Math.abs(m1Y - m2Y) - maxY / 2) < halfMaxY + 1) (Math.abs(Math.abs(m1X - m2X) - maxX) < halfMaxX + 1 && Math.abs(Math.abs(m1Y - m2Y) - maxY / 2) < halfMaxY + 1)
) )
@ -2357,9 +2353,9 @@ export const useTrestle = () => {
} }
if (Math.abs(m1X - m2X) < 1) { if (Math.abs(m1X - m2X) < 1) {
return Math.abs(Math.abs(m1Y - m2Y) - maxX) < 1 || Math.abs(m2Y - m1Y) <= halfMaxY return Math.abs(Math.abs(m1Y - m2Y) - maxX) < 1
} else if (Math.abs(m1Y - m2Y) < 1) { } else if (Math.abs(m1Y - m2Y) < 1) {
return Math.abs(Math.abs(m1X - m2X) - maxY) < 1 || Math.abs(m2X - m1X) <= halfMaxX return Math.abs(Math.abs(m1X - m2X) - maxY) < 1
} }
return ( return (
@ -3205,7 +3201,6 @@ export const useTrestle = () => {
let cnt = 0 let cnt = 0
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE) const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
debugger
surfaces.forEach((surface) => { surfaces.forEach((surface) => {
const modules = surface.modules const modules = surface.modules
const groups = groupByType(modules) const groups = groupByType(modules)