Compare commits
6 Commits
9a543c4b90
...
36211f04bd
| Author | SHA1 | Date | |
|---|---|---|---|
| 36211f04bd | |||
| 5c592e95cc | |||
| a37bf6e4f7 | |||
| c25e8b2a4a | |||
| 9b8727a63a | |||
| 8853b7ae86 |
@ -212,6 +212,7 @@ export const SAVE_KEY = [
|
||||
'endPoint',
|
||||
'editable',
|
||||
'isSortedPoints',
|
||||
'isMultipleOf45',
|
||||
]
|
||||
|
||||
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype]
|
||||
|
||||
@ -731,7 +731,7 @@ export default function Estimate({}) {
|
||||
/* 케이블 select 변경시 */
|
||||
const onChangeDisplayCableItem = (value, itemList) => {
|
||||
itemList.map((item, index) => {
|
||||
if (item.dispCableFlg === '1' && item.itemTpCd !== 'M12') {
|
||||
if (item.dispCableFlg === '1' && item.itemTpCd !== 'M12' && item.itemTpCd !== 'S13') {
|
||||
if (value !== '') {
|
||||
onChangeDisplayItem(value, item.dispOrder, index, true)
|
||||
}
|
||||
@ -743,7 +743,7 @@ export default function Estimate({}) {
|
||||
/* 케이블 select 변경시 */
|
||||
const onChangeDisplayDoubleCableItem = (value, itemList) => {
|
||||
itemList.map((item, index) => {
|
||||
if (item.dispCableFlg === '1' && item.itemTpCd === 'M12') {
|
||||
if (item.dispCableFlg === '1' && (item.itemTpCd === 'M12' || item.itemTpCd === 'S13')) {
|
||||
if (value !== '') {
|
||||
onChangeDisplayItem(value, item.dispOrder, index, true)
|
||||
}
|
||||
@ -1103,7 +1103,7 @@ export default function Estimate({}) {
|
||||
|
||||
if (item.dispCableFlg === '1' ) {
|
||||
dispCableFlgCnt++
|
||||
if(item.itemTpCd === 'M12') {
|
||||
if(item.itemTpCd === 'M12' || item.itemTpCd === 'S13') {
|
||||
setCableDbItem(item.itemId)
|
||||
}else{
|
||||
setCableItem(item.itemId)
|
||||
@ -1179,7 +1179,7 @@ export default function Estimate({}) {
|
||||
|
||||
if (item.dispCableFlg === '1'){
|
||||
|
||||
if(item.itemTpCd === 'M12') {
|
||||
if(item.itemTpCd === 'M12' || item.itemTpCd === 'S13') {
|
||||
setCableDbItem(item.itemId)
|
||||
}else{
|
||||
setCableItem(item.itemId)
|
||||
@ -2031,13 +2031,13 @@ export default function Estimate({}) {
|
||||
getOptionValue={(x) => x.clRefChr1}
|
||||
components={{
|
||||
SingleValue: ({ children, ...props }) => {
|
||||
return <components.SingleValue {...props}>{(item.itemTpCd === 'M12')? item.itemName : props.data.clRefChr3}</components.SingleValue>
|
||||
return <components.SingleValue {...props}>{(item.itemTpCd === 'M12' || item.itemTpCd === 'S13')? item.itemName : props.data.clRefChr3}</components.SingleValue>
|
||||
},
|
||||
}}
|
||||
isClearable={false}
|
||||
isDisabled={true}
|
||||
value={cableItemList.filter(function (option) {
|
||||
return (item.itemTpCd === 'M12')? item.itemId : option.clRefChr1 === item.itemId
|
||||
return (item.itemTpCd === 'M12' || item.itemTpCd === 'S13' )? item.itemId : option.clRefChr1 === item.itemId
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -210,8 +210,26 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||
line.startPoint = point
|
||||
line.endPoint = nextPoint
|
||||
this.lines.push(line)
|
||||
this.calculateDegree()
|
||||
})
|
||||
},
|
||||
calculateDegree() {
|
||||
const degrees = []
|
||||
// polygon.lines를 순회하며 각도를 구해 출력
|
||||
this.lines.forEach((line, idx) => {
|
||||
const dx = line.x2 - line.x1
|
||||
const dy = line.y2 - line.y1
|
||||
const rad = Math.atan2(dy, dx)
|
||||
const degree = (rad * 180) / Math.PI
|
||||
degrees.push(degree)
|
||||
})
|
||||
|
||||
function isMultipleOf45(degree, epsilon = 1) {
|
||||
return Math.abs(degree % 45) <= epsilon || Math.abs((degree % 45) - 45) <= epsilon
|
||||
}
|
||||
|
||||
this.isMultipleOf45 = degrees.every((degree) => isMultipleOf45(degree))
|
||||
},
|
||||
|
||||
/**
|
||||
* 보조선 그리기
|
||||
|
||||
@ -2287,17 +2287,21 @@ export const useTrestle = () => {
|
||||
const { width: currentWidth, height: currentHeight, moduleInfo: currentModuleInfo } = m1
|
||||
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: neighborModuleTpCd } = neighborModuleInfo
|
||||
const { x: m1X, y: m1Y } = m1.getCenterPoint()
|
||||
const { x: m2X, y: m2Y } = m2.getCenterPoint()
|
||||
|
||||
sizes.push({ width: currentWidth, height: currentHeight })
|
||||
|
||||
if (currentModuleTpCd !== neighborModuleTpCd) {
|
||||
sizes.push({ width: neighborWidth, height: neighborHeight })
|
||||
}
|
||||
|
||||
/*m1.set({ fill: m1Fill })
|
||||
/*
|
||||
m1.set({ fill: m1Fill })
|
||||
m2.set({ fill: m2Fill })
|
||||
canvas.renderAll()*/
|
||||
|
||||
@ -2331,13 +2335,13 @@ export const useTrestle = () => {
|
||||
// console.log(maxX, maxY, halfMaxX, halfMaxY)
|
||||
|
||||
if (Math.abs(m1X - m2X) < 1) {
|
||||
return Math.abs(Math.abs(m1Y - m2Y) - maxY) < 1
|
||||
return Math.abs(Math.abs(m1Y - m2Y) - maxY) < 1 || Math.abs(m2Y - m1Y) <= halfMaxY
|
||||
} else if (Math.abs(m1Y - m2Y) < 1) {
|
||||
return Math.abs(Math.abs(m1X - m2X) - maxX) < 1
|
||||
return Math.abs(Math.abs(m1X - m2X) - maxX) < 1 || Math.abs(m2X - m1X) <= halfMaxX
|
||||
}
|
||||
|
||||
return (
|
||||
(Math.abs(m1X - m2X) < maxX - moduleIntvlHor / 10 && Math.abs(m1Y - m2Y) < maxY - moduleIntvlVer / 10) ||
|
||||
(Math.abs(m1X - m2X) < maxX - moduleIntvlHor / 10 + 1 && 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) < halfMaxX + 1 && Math.abs(Math.abs(m1Y - m2Y) - maxY / 2) < halfMaxY + 1)
|
||||
)
|
||||
@ -2353,9 +2357,9 @@ export const useTrestle = () => {
|
||||
}
|
||||
|
||||
if (Math.abs(m1X - m2X) < 1) {
|
||||
return Math.abs(Math.abs(m1Y - m2Y) - maxX) < 1
|
||||
return Math.abs(Math.abs(m1Y - m2Y) - maxX) < 1 || Math.abs(m2Y - m1Y) <= halfMaxY
|
||||
} else if (Math.abs(m1Y - m2Y) < 1) {
|
||||
return Math.abs(Math.abs(m1X - m2X) - maxY) < 1
|
||||
return Math.abs(Math.abs(m1X - m2X) - maxY) < 1 || Math.abs(m2X - m1X) <= halfMaxX
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user