xzw 8 bulan lalu
induk
melakukan
19549502cb
3 mengubah file dengan 186 tambahan dan 160 penghapusan
  1. 177 155
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 8 4
      src/sdk/cover/index.js

+ 177 - 155
public/lib/potree/potree.js

@@ -42280,6 +42280,137 @@
 
 	 */
 
+	//处理cursor优先级
+
+	var CursorDeal = {
+	  priorityEvent: [
+	  //在前面的优先级高
+
+	  {
+	    pen_delPoint: "url({Potree.resourcePath}/images/polygon_mark/pic_pen_sub.png),auto"
+	  }, {
+	    pen_addPoint: "url({Potree.resourcePath}/images/polygon_mark/pic_pen_add.png),auto"
+	  }, {
+	    pen: "url({Potree.resourcePath}/images/polygon_mark/pic_pen.png),auto"
+	  }, {
+	    'grabbing': 'grabbing'
+	  },
+	  //通用
+	  {
+	    'hoverGrab': 'grab'
+	  },
+	  //通用
+	  {
+	    'pointer': 'pointer'
+	  },
+	  //通用
+
+	  {
+	    'zoomInCloud': 'zoom-in'
+	  }, {
+	    'hoverPano': 'pointer'
+	  }, {
+	    "notAllowed-default": 'not-allowed'
+	  }, {
+	    'connectPano': "url({Potree.resourcePath}/images/connect.png),auto"
+	  }, {
+	    'disconnectPano': "url({Potree.resourcePath}/images/connect-dis.png),auto"
+	  }, {
+	    'hoverLine': 'pointer'
+	  }, {
+	    'hoverTranHandle': 'grab'
+	  }, {
+	    "movePointcloud": 'move'
+	  }, {
+	    "polygon_isIntersectSelf": 'not-allowed'
+	  }, {
+	    "polygon_AtWrongPlace": 'not-allowed'
+	  }, {
+	    'delPoint': 'url("https://4dkk.4dage.com/v4-test/www/sdk/images/polygon_mark/pic_pen_sub.png"), auto'
+	  }, {
+	    "markerMove": 'grab'
+	  }, {
+	    'addPoint': 'url("https://4dkk.4dage.com/v4-test/www/sdk/images/polygon_mark/pic_pen_add.png"), auto'
+	  }, {
+	    'mapClipMove': 'move'
+	  }, {
+	    'mapClipRotate': "url({Potree.resourcePath}/images/rotate-cursor.png),auto"
+	  }, {
+	    'rotatePointcloud': "url({Potree.resourcePath}/images/rotate-cursor.png),auto"
+	  }, {
+	    'siteModelFloorDrag': 'row-resize'
+	  }, {
+	    'addSth': 'cell'
+	  } //or  crosshair
+	  ],
+	  list: [],
+	  //当前存在的cursor状态
+	  currentCursorIndex: null,
+	  init: function init(viewer, viewers) {
+	    this.priorityEvent.forEach(e => {
+	      //刚开始Potree.resourcePath没值,现在换
+	      for (var i in e) {
+	        e[i] = Common.replaceAll(e[i], '{Potree.resourcePath}', Potree.resourcePath);
+	      }
+	    });
+	    this.domElements = viewers.map(e => e.renderArea);
+	    viewer.addEventListener("CursorChange", e => {
+	      if (e.action == 'add') {
+	        this.add(e.name);
+	      } else {
+	        this.remove(e.name);
+	      }
+	    });
+	  },
+	  add: function add(name) {
+	    var priorityItem = this.priorityEvent.find(e => e[name]);
+	    if (!priorityItem) {
+	      console.error('CursorDeal  未定义优先级 name:' + name);
+	      return;
+	    }
+	    if (!this.list.includes(name)) {
+	      this.judge({
+	        addItem: priorityItem,
+	        name
+	      });
+	      this.list.push(name);
+	    }
+	  },
+	  remove: function remove(name) {
+	    var index = this.list.indexOf(name);
+	    if (index > -1) {
+	      this.list.splice(index, 1);
+	      this.judge();
+	    }
+	  },
+	  judge: function judge() {
+	    var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+	    //console.log(o,this.list)
+	    if (o.addItem) {
+	      var addIndex = this.priorityEvent.indexOf(o.addItem);
+	      if (addIndex < this.currentCursorIndex || this.currentCursorIndex == void 0) {
+	        this.domElements.forEach(e => e.style.cursor = o.addItem[o.name]);
+	        this.currentCursorIndex = addIndex;
+	      }
+	    } else {
+	      var levelMax = {
+	        index: Infinity,
+	        cursor: null
+	      };
+	      this.list.forEach(name => {
+	        var priorityItem = this.priorityEvent.find(e => e[name]);
+	        var index = this.priorityEvent.indexOf(priorityItem);
+	        if (index < levelMax.index) {
+	          levelMax.index = index;
+	          levelMax.cursor = priorityItem[name];
+	        }
+	      });
+	      this.currentCursorIndex = levelMax.index;
+	      this.domElements.forEach(e => e.style.cursor = levelMax.cursor || '');
+	    }
+	  }
+	};
+
 	var texLoader$7 = new TextureLoader();
 	var labelSizeInfo$1 = {
 	  width2d: 180
@@ -42499,7 +42630,7 @@
 	    {
 	      //和measure不同的是它的边是连在一起的一整条
 	      this.edge = new Mesh(voidGeometry, new DepthBasicMaterial($.extend({}, depthProps, {
-	        color: this.pathColor || '#fff',
+	        color: this.pathColor,
 	        opacity: 0.3,
 	        side: 2,
 	        transparent: true,
@@ -42512,7 +42643,7 @@
 	      this.edge.name = 'pathEdge';
 	      var addHoverEvent = () => {
 	        var mouseover = e => {
-	          this.setSelected(true, 'edge');
+	          this.setSelected('hover');
 	          this.hoverStates.edge = true;
 	          if (this.addOrRemovePoint && !this.isNew) {
 	            viewer.dispatchEvent({
@@ -42523,7 +42654,7 @@
 	          }
 	        };
 	        var mouseleave = e => {
-	          this.setSelected(false, 'edge');
+	          this.setSelected('unhover');
 	          this.hoverStates.edge = false;
 	          viewer.dispatchEvent({
 	            type: "CursorChange",
@@ -42566,7 +42697,7 @@
 	            this.hideArrowUntilUpdate();
 	            this.dispatchEvent('changed');
 	          } else {
-	            this.isNew || viewer.measuringTool.isAdding || this.dispatchEvent('clicked'); //viewer.focusOnObject(this, 'measure') //正在添加测量线时不要focus其他线(容易误触)
+	            this.isNew || viewer.measuringTool.isAdding || this.setSelected('click'); //viewer.focusOnObject(this, 'measure') //正在添加测量线时不要focus其他线(容易误触)
 	          }
 	        });
 	      };
@@ -43019,28 +43150,45 @@
 	    viewer.mapViewer && viewer.mapViewer.dispatchEvent('content_changed');
 	    viewer.dispatchEvent('content_changed');
 	  }
-	  setSelected(state, hoverObject) {
-	    //console.log('setSelected',state, hoverObject)
-
-	    var absoluteState = !!state;
-	    if (hoverObject) {
-	      //如果没有hoverObject且state为false 就强制取消选中态
-	      this.selectStates[hoverObject] = state;
-	      for (var i in this.selectStates) {
-	        if (this.selectStates[i]) {
-	          absoluteState = true;
-	          break;
+	  setSelected( /* state, hoverObject */state, byList) {
+	    var _this$arrows2;
+	    /* let absoluteState = !!state  
+	    if(hoverObject){//如果没有hoverObject且state为false 就强制取消选中态
+	        this.selectStates[hoverObject] = state
+	        for(var i in this.selectStates){
+	            if(this.selectStates[i]){
+	                absoluteState = true; break;
+	            }
 	        }
-	      }
-	    }
-	    this.selected = absoluteState;
-	    if (hoverObject != 'byList') {
-	      //this.bus && this.bus.emit('highlight', this.selected)
-	      this.dispatchEvent({
-	        type: 'highlight',
-	        state: this.selected
-	      }); //列表高亮
-	    }
+	    } 
+	    this.selected = absoluteState*/
+	    state == 'hover' && (this.selectStates.hover = true, byList || this.dispatchEvent({
+	      type: 'highlight',
+	      state: true
+	    }), CursorDeal.add('pointer'));
+	    state == 'unhover' && (this.selectStates.hover = false, byList || this.dispatchEvent({
+	      type: 'highlight',
+	      state: false
+	    }), CursorDeal.remove('pointer'));
+	    state == 'click' && (this.selectStates.click = true, byList || this.dispatchEvent({
+	      type: 'chose',
+	      state: true
+	    }));
+	    state == 'unclick' && (this.selectStates.click = false, byList || this.dispatchEvent({
+	      type: 'chose',
+	      state: false
+	    }));
+	    this.edge.material.color.set(this.selectStates.click ? '#00C8AF' : this.pathColor);
+	    (_this$arrows2 = this.arrows) === null || _this$arrows2 === void 0 || _this$arrows2.material.color.set(this.selectStates.click ? '#ffffff' : this.pathColor);
+	    [this.edge, this.endCaps[0].children[0]].forEach(e => e.material.opacity = this.selectStates.click ? 0.8 : this.selectStates.hover ? 0.6 : 0.3);
+	    state == 'click' && setTimeout(() => {
+	      viewer.addEventListener('global_click', e => {
+	        //再点击取消 
+	        this.setSelected('unclick');
+	      }, {
+	        once: true
+	      });
+	    }, 10);
 	    viewer.dispatchEvent('content_changed');
 	    viewer.mapViewer && viewer.mapViewer.dispatchEvent('content_changed');
 	  }
@@ -43106,12 +43254,12 @@
 	    viewer.dispatchEvent('content_changed');
 	  }
 	  dispose() {
-	    var _this$arrows2, _this$arrows3;
+	    var _this$arrows3, _this$arrows4;
 	    super.dispose();
 	    this.titleLabel.dispose();
 	    this.markerLabels.forEach(e => e.dispose());
-	    (_this$arrows2 = this.arrows) === null || _this$arrows2 === void 0 || _this$arrows2.dispose();
-	    (_this$arrows3 = this.arrows) === null || _this$arrows3 === void 0 || _this$arrows3.material.dispose();
+	    (_this$arrows3 = this.arrows) === null || _this$arrows3 === void 0 || _this$arrows3.dispose();
+	    (_this$arrows4 = this.arrows) === null || _this$arrows4 === void 0 || _this$arrows4.material.dispose();
 	    this.edge.geometry.dispose();
 	    this.edge.material.dispose();
 	  }
@@ -43128,7 +43276,7 @@
 	          transparent: true,
 	          side: 2,
 	          fadeFar: this.fadeFar,
-	          color: this.pathColor || '#fff'
+	          color: this.selectStates.click ? '#ffffff' : this.pathColor
 	        }));
 	        //let material = new THREE.MeshBasicMaterial({map )})
 	        this.arrows = new InstancedMesh(planeGeo$2, material, arrowCountMax); //会自动向shader添加define和instanceMatrix
@@ -64393,132 +64541,6 @@
 	}
 	;
 
-	//处理cursor优先级
-
-	var CursorDeal = {
-	  priorityEvent: [
-	  //在前面的优先级高
-
-	  {
-	    pen_delPoint: "url({Potree.resourcePath}/images/polygon_mark/pic_pen_sub.png),auto"
-	  }, {
-	    pen_addPoint: "url({Potree.resourcePath}/images/polygon_mark/pic_pen_add.png),auto"
-	  }, {
-	    pen: "url({Potree.resourcePath}/images/polygon_mark/pic_pen.png),auto"
-	  }, {
-	    'grabbing': 'grabbing'
-	  },
-	  //通用
-	  {
-	    'hoverGrab': 'grab'
-	  },
-	  //通用
-	  {
-	    'zoomInCloud': 'zoom-in'
-	  }, {
-	    'hoverPano': 'pointer'
-	  }, {
-	    "notAllowed-default": 'not-allowed'
-	  }, {
-	    'connectPano': "url({Potree.resourcePath}/images/connect.png),auto"
-	  }, {
-	    'disconnectPano': "url({Potree.resourcePath}/images/connect-dis.png),auto"
-	  }, {
-	    'hoverLine': 'pointer'
-	  }, {
-	    'hoverTranHandle': 'grab'
-	  }, {
-	    "movePointcloud": 'move'
-	  }, {
-	    "polygon_isIntersectSelf": 'not-allowed'
-	  }, {
-	    "polygon_AtWrongPlace": 'not-allowed'
-	  }, {
-	    'delPoint': 'url("https://4dkk.4dage.com/v4-test/www/sdk/images/polygon_mark/pic_pen_sub.png"), auto'
-	  }, {
-	    "markerMove": 'grab'
-	  }, {
-	    'addPoint': 'url("https://4dkk.4dage.com/v4-test/www/sdk/images/polygon_mark/pic_pen_add.png"), auto'
-	  }, {
-	    'mapClipMove': 'move'
-	  }, {
-	    'mapClipRotate': "url({Potree.resourcePath}/images/rotate-cursor.png),auto"
-	  }, {
-	    'rotatePointcloud': "url({Potree.resourcePath}/images/rotate-cursor.png),auto"
-	  }, {
-	    'siteModelFloorDrag': 'row-resize'
-	  }, {
-	    'addSth': 'cell'
-	  } //or  crosshair
-	  ],
-	  list: [],
-	  //当前存在的cursor状态
-	  currentCursorIndex: null,
-	  init: function init(viewer, viewers) {
-	    this.priorityEvent.forEach(e => {
-	      //刚开始Potree.resourcePath没值,现在换
-	      for (var i in e) {
-	        e[i] = Common.replaceAll(e[i], '{Potree.resourcePath}', Potree.resourcePath);
-	      }
-	    });
-	    this.domElements = viewers.map(e => e.renderArea);
-	    viewer.addEventListener("CursorChange", e => {
-	      if (e.action == 'add') {
-	        this.add(e.name);
-	      } else {
-	        this.remove(e.name);
-	      }
-	    });
-	  },
-	  add: function add(name) {
-	    var priorityItem = this.priorityEvent.find(e => e[name]);
-	    if (!priorityItem) {
-	      console.error('CursorDeal  未定义优先级 name:' + name);
-	      return;
-	    }
-	    if (!this.list.includes(name)) {
-	      this.judge({
-	        addItem: priorityItem,
-	        name
-	      });
-	      this.list.push(name);
-	    }
-	  },
-	  remove: function remove(name) {
-	    var index = this.list.indexOf(name);
-	    if (index > -1) {
-	      this.list.splice(index, 1);
-	      this.judge();
-	    }
-	  },
-	  judge: function judge() {
-	    var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
-	    //console.log(o,this.list)
-	    if (o.addItem) {
-	      var addIndex = this.priorityEvent.indexOf(o.addItem);
-	      if (addIndex < this.currentCursorIndex || this.currentCursorIndex == void 0) {
-	        this.domElements.forEach(e => e.style.cursor = o.addItem[o.name]);
-	        this.currentCursorIndex = addIndex;
-	      }
-	    } else {
-	      var levelMax = {
-	        index: Infinity,
-	        cursor: null
-	      };
-	      this.list.forEach(name => {
-	        var priorityItem = this.priorityEvent.find(e => e[name]);
-	        var index = this.priorityEvent.indexOf(priorityItem);
-	        if (index < levelMax.index) {
-	          levelMax.index = index;
-	          levelMax.cursor = priorityItem[name];
-	        }
-	      });
-	      this.currentCursorIndex = levelMax.index;
-	      this.domElements.forEach(e => e.style.cursor = levelMax.cursor || '');
-	    }
-	  }
-	};
-
 	class SplitScreen extends EventDispatcher {
 	  constructor() {
 	    var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

File diff ditekan karena terlalu besar
+ 1 - 1
public/lib/potree/potree.js.map


+ 8 - 4
src/sdk/cover/index.js

@@ -1376,8 +1376,9 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                         pos:  e.root ? Potree.Utils.datasetPosTransform({toDataset:true, position: e.position.clone(),  datasetId: e.root.dataset_id  }) : e.position.clone()
                     }) 
                 })
-                path.addEventListener('clicked',(e)=>{
-                    bus.emit('focus') 
+                
+                path.addEventListener('chose',(e)=>{
+                    bus.emit('focus', e.state) 
                 })
                  
             }
@@ -1442,8 +1443,11 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     //path.setFadeFar(( far== -1 || path.editEnable) ? null : far) //注意:编辑时显示全部
                     path.setFadeFar(far== -1 ? 0 : far) 
                 },
-                focus(){//highlight
-                    
+                highlight(state){ 
+                    path.setSelected(state?'hover':'unhover', true)
+                },
+                focus(state){
+                    path.setSelected(state?'click':'unclick', true)
                 },
                 changeDirection(show,reverse){
                     path.setArrowDisplay(show)