QPolygon containsPoint 단계에 따라 다르게 작동하도록 수정
This commit is contained in:
parent
9c5e21aa41
commit
021e425c84
@ -4,7 +4,7 @@ import { QLine } from '@/components/fabric/QLine'
|
|||||||
import { distanceBetweenPoints, findTopTwoIndexesByDistance, getDirectionByPoint, sortedPointLessEightPoint, sortedPoints } from '@/util/canvas-util'
|
import { distanceBetweenPoints, findTopTwoIndexesByDistance, getDirectionByPoint, sortedPointLessEightPoint, sortedPoints } from '@/util/canvas-util'
|
||||||
import { calculateAngle, drawGabledRoof, drawRidgeRoof, drawShedRoof, inPolygon, toGeoJSON } from '@/util/qpolygon-utils'
|
import { calculateAngle, drawGabledRoof, drawRidgeRoof, drawShedRoof, inPolygon, toGeoJSON } from '@/util/qpolygon-utils'
|
||||||
import * as turf from '@turf/turf'
|
import * as turf from '@turf/turf'
|
||||||
import { LINE_TYPE } from '@/common/common'
|
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
|
||||||
|
|
||||||
export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
||||||
type: 'QPolygon',
|
type: 'QPolygon',
|
||||||
@ -690,6 +690,15 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
|
|||||||
|
|
||||||
return intersects % 2 === 1
|
return intersects % 2 === 1
|
||||||
},
|
},
|
||||||
|
containsPoint: function (point) {
|
||||||
|
if (this.name === POLYGON_TYPE.ROOF && this.isFixed) {
|
||||||
|
const isInside = this.inPolygon(point)
|
||||||
|
this.set('selectable', isInside)
|
||||||
|
return isInside
|
||||||
|
} else {
|
||||||
|
return this.callSuper('containsPoint', point)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
inPolygonABType(x, y, polygon) {
|
inPolygonABType(x, y, polygon) {
|
||||||
let inside = false
|
let inside = false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user