border 제거 후 polygon 내부 선택 시 해당 polygon 선택

This commit is contained in:
hyojun.choi 2024-11-11 17:01:36 +09:00
parent 3a31a6e328
commit b35c26e6dc

View File

@ -131,10 +131,9 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
this.on('selected', () => { this.on('selected', () => {
Object.keys(this.controls).forEach((controlKey) => { Object.keys(this.controls).forEach((controlKey) => {
if (controlKey !== 'ml' && controlKey !== 'mr') { this.setControlVisible(controlKey, false)
this.setControlVisible(controlKey, false)
}
}) })
this.set({ hasBorders: false })
}) })
this.on('removed', () => { this.on('removed', () => {
@ -191,7 +190,12 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
line.endPoint = nextPoint line.endPoint = nextPoint
this.lines.push(line) this.lines.push(line)
}) })
// } },
containsPoint: function (point) {
const isInside = this.inPolygon(point)
this.set('selectable', isInside)
return isInside
}, },
// 보조선 그리기 // 보조선 그리기