From d4dcf3fed13503bec14c3d4d418aa4c565ddf8b8 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 15 Nov 2023 16:24:13 -0500 Subject: [PATCH] Potree: remove last camera animation --- .../js/vendor/potree/build/potree/potree.js | 21 ++++++++++++++++++- .../potree/resources/lang/en/translation.json | 3 ++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/static/app/js/vendor/potree/build/potree/potree.js b/app/static/app/js/vendor/potree/build/potree/potree.js index 89dd49d7..6367cce0 100644 --- a/app/static/app/js/vendor/potree/build/potree/potree.js +++ b/app/static/app/js/vendor/potree/build/potree/potree.js @@ -71454,7 +71454,7 @@ void main() { }; removeCameraAnimation(animation){ - let index = this.cameraAnimations.indexOf(volume); + let index = this.cameraAnimations.indexOf(animation); if (index > -1) { this.cameraAnimations.splice(index, 1); @@ -79722,10 +79722,18 @@ ENDSEC tree.jstree("delete_node", jsonNode.id); }; + let oCameraAnimationRemoved = (e) => { + let otherRoot = $("#jstree_scene").jstree().get_json("other"); + let jsonNode = otherRoot.children.find(child => child.data.uuid === e.animation.uuid); + + tree.jstree("delete_node", jsonNode.id); + }; + this.viewer.scene.addEventListener("measurement_removed", onMeasurementRemoved); this.viewer.scene.addEventListener("volume_removed", onVolumeRemoved); this.viewer.scene.addEventListener("polygon_clip_volume_removed", onPolygonClipVolumeRemoved); this.viewer.scene.addEventListener("profile_removed", onProfileRemoved); + this.viewer.scene.addEventListener("camera_animation_removed", oCameraAnimationRemoved); { let annotationIcon = `${Potree.resourcePath}/icons/annotation.svg`; @@ -80447,6 +80455,17 @@ ENDSEC } )); + elNavigation.append(this.createToolIcon( + Potree.resourcePath + '/icons/reset_tools.svg', + '[title]tt.remove_last_camera_animation', + () => { + if (viewer.scene.cameraAnimations.length > 0){ + let a = viewer.scene.cameraAnimations[viewer.scene.cameraAnimations.length - 1]; + viewer.scene.removeCameraAnimation(a); + a.setVisible(false); + } + } + )); elNavigation.append("
"); diff --git a/app/static/app/js/vendor/potree/build/potree/resources/lang/en/translation.json b/app/static/app/js/vendor/potree/build/potree/resources/lang/en/translation.json index 938ba880..1154fdb7 100644 --- a/app/static/app/js/vendor/potree/build/potree/resources/lang/en/translation.json +++ b/app/static/app/js/vendor/potree/build/potree/resources/lang/en/translation.json @@ -46,7 +46,8 @@ "navigation_cube_control": "Navigation cube", "remove_all_clipping_volumes": "Remove all clipping volumes", "compass": "Compass", - "camera_animation": "Camera Animation" + "camera_animation": "Camera Animation", + "remove_last_camera_animation": "Remove last camera animation" }, "appearance": { "nb_max_pts": "Point budget",