From 8c779f32e2d21b321f704e7bbfab5a0da027766b Mon Sep 17 00:00:00 2001 From: m-schuetz Date: Wed, 28 Jun 2017 11:07:15 +0200 Subject: [PATCH] some annotation / map fixes --- src/viewer/map.js | 11 +++++++---- src/viewer/viewer.js | 10 ++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/viewer/map.js b/src/viewer/map.js index c12da0cd..b666fb82 100644 --- a/src/viewer/map.js +++ b/src/viewer/map.js @@ -292,7 +292,6 @@ Potree.MapView = class{ }; this.onAnnotationAdded = e => { - if(!this.sceneProjection){ return; } @@ -321,7 +320,6 @@ Potree.MapView = class{ }; this.getAnnotationsLayer().getSource().addFeature(feature); - }; this.setScene(this.viewer.scene); @@ -342,9 +340,14 @@ Potree.MapView = class{ this.scene.addEventListener("pointcloud_added", this.onPointcloudAdded); this.scene.annotations.addEventListener("annotation_added", this.onAnnotationAdded); - for(var i = 0; i < this.viewer.scene.pointclouds.length; i++){ - this.load(this.viewer.scene.pointclouds[i]); + for(let pointcloud of this.viewer.scene.pointclouds){ + this.load(pointcloud); } + + console.log("map.setScene"); + this.viewer.scene.annotations.traverseDescendants(annotation => { + this.onAnnotationAdded({annotation: annotation}); + }); } getExtentsLayer(){ diff --git a/src/viewer/viewer.js b/src/viewer/viewer.js index 9f55775d..ced6130d 100644 --- a/src/viewer/viewer.js +++ b/src/viewer/viewer.js @@ -511,10 +511,10 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{ }; } - this.scene.annotations.addEventListener("annotation_added", this.onAnnotationAdded); if(oldScene){ oldScene.annotations.removeEventListener("annotation_added", this.onAnnotationAdded); } + this.scene.annotations.addEventListener("annotation_added", this.onAnnotationAdded); } }; @@ -1183,13 +1183,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{ if(!this.getShowAnnotations()){ this.scene.annotations.traverseDescendants(descendant => { - if(!descendant.__visible || !descendant.visible){ - return false; - }else{ - descendant.__visible = false; - //descendant.domElement[0].style.display = "none"; - descendant.domElement.fadeOut(200); - } + descendant.display = false; return; });