can pair actions with annotations
This commit is contained in:
parent
b4cd822b9e
commit
9cb302d395
@ -6067,6 +6067,10 @@ Potree.Annotation = class extends THREE.EventDispatcher{
|
||||
return new Potree.Action(a);
|
||||
}
|
||||
});
|
||||
|
||||
for(let action of this.actions){
|
||||
action.pairWith(this);
|
||||
}
|
||||
|
||||
let actions = this.actions.filter(
|
||||
a => a.showIn === undefined || a.showIn.includes("scene"));
|
||||
@ -6273,6 +6277,10 @@ Potree.Annotation = class extends THREE.EventDispatcher{
|
||||
}
|
||||
|
||||
set visible(value){
|
||||
if(this._visible === value){
|
||||
return;
|
||||
}
|
||||
|
||||
this._visible = value;
|
||||
|
||||
if(!value){
|
||||
@ -6283,9 +6291,13 @@ Potree.Annotation = class extends THREE.EventDispatcher{
|
||||
}else{
|
||||
this.traverse(node => {
|
||||
node.__visible = true;
|
||||
//node.domElement.css("display", "inline-block");
|
||||
});
|
||||
}
|
||||
|
||||
this.dispatchEvent({
|
||||
type: "visibility_changed",
|
||||
annotation: this
|
||||
});
|
||||
}
|
||||
|
||||
toString(){
|
||||
@ -6312,6 +6324,10 @@ Potree.Action = class Action extends THREE.EventDispatcher{
|
||||
|
||||
}
|
||||
|
||||
pairWith(object){
|
||||
|
||||
}
|
||||
|
||||
setIcon(newIcon){
|
||||
let oldIcon = this.icon;
|
||||
|
||||
@ -6343,6 +6359,25 @@ Potree.Actions.ToggleAnnotationVisibility = class ToggleAnnotationVisibility ext
|
||||
this.tooltip = "toggle visibility";
|
||||
}
|
||||
|
||||
pairWith(annotation){
|
||||
|
||||
if(annotation.visible){
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye.svg");
|
||||
}else{
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye_crossed.svg");
|
||||
}
|
||||
|
||||
annotation.addEventListener("visibility_changed", e => {
|
||||
let annotation = e.annotation;
|
||||
|
||||
if(annotation.visible){
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye.svg");
|
||||
}else{
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye_crossed.svg");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onclick(event){
|
||||
let annotation = event.annotation;
|
||||
|
||||
@ -11138,8 +11173,8 @@ Potree.GeoJSONExporter = class GeoJSONExporter{
|
||||
/**
|
||||
*
|
||||
* @author sigeom sa / http://sigeom.ch
|
||||
* @author Ioda-Net Sàrl / https://www.ioda-net.ch/
|
||||
* @author Markus Schütz / http://potree.org
|
||||
* @author Ioda-Net S<EFBFBD>rl / https://www.ioda-net.ch/
|
||||
* @author Markus Sch<EFBFBD>tz / http://potree.org
|
||||
*
|
||||
*/
|
||||
|
||||
@ -12848,9 +12883,9 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
this.progressBar = new ProgressBar();
|
||||
|
||||
this.stats = new Stats();
|
||||
this.stats.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom
|
||||
document.body.appendChild( this.stats.dom );
|
||||
this.stats.dom.style.left = "100px";
|
||||
//this.stats.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom
|
||||
//document.body.appendChild( this.stats.dom );
|
||||
//this.stats.dom.style.left = "100px";
|
||||
|
||||
this.potreeRenderer = null;
|
||||
this.highQualityRenderer = null;
|
||||
|
||||
@ -17,6 +17,10 @@ Potree.Action = class Action extends THREE.EventDispatcher{
|
||||
|
||||
}
|
||||
|
||||
pairWith(object){
|
||||
|
||||
}
|
||||
|
||||
setIcon(newIcon){
|
||||
let oldIcon = this.icon;
|
||||
|
||||
@ -48,6 +52,25 @@ Potree.Actions.ToggleAnnotationVisibility = class ToggleAnnotationVisibility ext
|
||||
this.tooltip = "toggle visibility";
|
||||
}
|
||||
|
||||
pairWith(annotation){
|
||||
|
||||
if(annotation.visible){
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye.svg");
|
||||
}else{
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye_crossed.svg");
|
||||
}
|
||||
|
||||
annotation.addEventListener("visibility_changed", e => {
|
||||
let annotation = e.annotation;
|
||||
|
||||
if(annotation.visible){
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye.svg");
|
||||
}else{
|
||||
this.setIcon(Potree.resourcePath + "/icons/eye_crossed.svg");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onclick(event){
|
||||
let annotation = event.annotation;
|
||||
|
||||
|
||||
@ -71,6 +71,10 @@ Potree.Annotation = class extends THREE.EventDispatcher{
|
||||
return new Potree.Action(a);
|
||||
}
|
||||
});
|
||||
|
||||
for(let action of this.actions){
|
||||
action.pairWith(this);
|
||||
}
|
||||
|
||||
let actions = this.actions.filter(
|
||||
a => a.showIn === undefined || a.showIn.includes("scene"));
|
||||
@ -277,6 +281,10 @@ Potree.Annotation = class extends THREE.EventDispatcher{
|
||||
}
|
||||
|
||||
set visible(value){
|
||||
if(this._visible === value){
|
||||
return;
|
||||
}
|
||||
|
||||
this._visible = value;
|
||||
|
||||
if(!value){
|
||||
@ -287,9 +295,13 @@ Potree.Annotation = class extends THREE.EventDispatcher{
|
||||
}else{
|
||||
this.traverse(node => {
|
||||
node.__visible = true;
|
||||
//node.domElement.css("display", "inline-block");
|
||||
});
|
||||
}
|
||||
|
||||
this.dispatchEvent({
|
||||
type: "visibility_changed",
|
||||
annotation: this
|
||||
});
|
||||
}
|
||||
|
||||
toString(){
|
||||
|
||||
@ -376,9 +376,9 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
this.progressBar = new ProgressBar();
|
||||
|
||||
this.stats = new Stats();
|
||||
this.stats.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom
|
||||
document.body.appendChild( this.stats.dom );
|
||||
this.stats.dom.style.left = "100px";
|
||||
//this.stats.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom
|
||||
//document.body.appendChild( this.stats.dom );
|
||||
//this.stats.dom.style.left = "100px";
|
||||
|
||||
this.potreeRenderer = null;
|
||||
this.highQualityRenderer = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user