|
@@ -27,7 +27,6 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
this[i] = prop[i]
|
|
|
}
|
|
|
this.color = this.color || config.measure.default.color
|
|
|
-
|
|
|
|
|
|
if((this.atPlane || this.showArea ) && this.closed && this.dimension == '2d'){
|
|
|
this.areaPlane = this.createAreaPlane();
|
|
@@ -41,7 +40,7 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
this.edges = [];
|
|
|
|
|
|
this.center
|
|
|
- this.setEditEnable(true)
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -110,16 +109,7 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
}
|
|
|
|
|
|
|
|
|
- setEditEnable(state){
|
|
|
- this.editEnable = state
|
|
|
- if(state){
|
|
|
- this.markers.forEach(m=>m.dispatchEvent('addHoverEvent') )
|
|
|
- }else{
|
|
|
- this.markers.forEach(m=>m.removeEventListeners())
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
addMarker(o={}){
|
|
@@ -149,9 +139,7 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
o.marker.createTime = Date.now()
|
|
|
|
|
|
let addHoverEvent = (e)=>{
|
|
|
- if(o.marker._listeners?.startDragging || !this.editEnable)return //already has
|
|
|
-
|
|
|
- let mouseover = (e) => {
|
|
|
+ let mouseover = (e) => {
|
|
|
this.setMarkerSelected(e.object, 'hover', 'single');
|
|
|
viewer.dispatchEvent({
|
|
|
type : "CursorChange", action : "add", name:"markerMove"
|
|
@@ -195,7 +183,7 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
|
|
|
|
|
|
dragMarker(e){
|
|
|
- if(!this.editEnable)return
|
|
|
+
|
|
|
var I, atMap
|
|
|
|
|
|
if(e.hoverViewport != e.drag.dragViewport){//不能使用e.dragViewport,要使用drag中的,因为drag中存储的要一直继承下来,不因mouseup了而改变。
|
|
@@ -568,11 +556,11 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
|
|
|
}
|
|
|
|
|
|
- getPoint2dInfo(points=this.points){ //在更新areaplane之前必须更新过point2dInfo (针对所有点在同一平面上的)
|
|
|
+ getPoint2dInfo(points){ //在更新areaplane之前必须更新过point2dInfo (针对所有点在同一平面上的)
|
|
|
if(this.facePlane && (this.atPlane || Potree.settings.areaAtNotPlane)){
|
|
|
|
|
|
let facePlane = this.getFacePlane()
|
|
|
- if(!facePlane)return this.point2dInfo = null
|
|
|
+
|
|
|
var originPoint0 = points[0].clone()
|
|
|
var qua = math.getQuaBetween2Vector(facePlane.normal, new THREE.Vector3(0,0,1), new THREE.Vector3(0,0,1));
|
|
|
let points2d = points.map(e=>e.clone().applyQuaternion(qua))
|
|
@@ -654,8 +642,8 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
this.remove(edge);
|
|
|
this.edges.splice(edgeIndex, 1);
|
|
|
edge.geometry.dispose()
|
|
|
- }
|
|
|
- index == 0 ? this.getPoint2dInfo() : this.point2dInfo?.points2d.splice(index, 1); //add
|
|
|
+ }
|
|
|
+ this.point2dInfo && this.point2dInfo.points2d.splice(index, 1); //add
|
|
|
|
|
|
this.dispatchEvent({type:'removeMarker',index,marker})
|
|
|
|