diff --git a/src/utils/ClipVolume.js b/src/utils/ClipVolume.js
index 3ea30250..8eefcc57 100644
--- a/src/utils/ClipVolume.js
+++ b/src/utils/ClipVolume.js
@@ -4,13 +4,11 @@ Potree.ClipVolume = class extends THREE.Object3D{
constructor(axis){
super();
-
- this.axis = axis;
this.constructor.counter = (this.constructor.counter === undefined) ? 0 : this.constructor.counter + 1;
-
this.name = "clip_volume_" + this.constructor.counter;
+ this.axis = axis;
this.volWidth = 0.1;
if(axis != -1) {
@@ -101,7 +99,21 @@ Potree.ClipVolume = class extends THREE.Object3D{
}
this.update();
- }
+ };
+
+ offset(value) {
+ if(this.axis == Potree.ClipVolume.Axis.X) {
+ this.position.x = this.position.x + value;
+ } else if(this.axis == Potree.ClipVolume.Axis.Y) {
+ this.position.y = this.position.y + value;
+ } else if(this.axis == Potree.ClipVolume.Axis.Z) {
+ this.position.z = this.position.z + value;
+ } else {
+ // TODO, offset box?
+ }
+
+ this.dispatchEvent({"type": "clip_volume_changed", "volume": this});
+ };
update(){
this.boundingBox = this.box.geometry.boundingBox;
diff --git a/src/utils/ClippingTool.js b/src/utils/ClippingTool.js
index 45b0a1a9..604a4c38 100644
--- a/src/utils/ClippingTool.js
+++ b/src/utils/ClippingTool.js
@@ -7,6 +7,7 @@ Potree.ClippingTool = class ClippingTool extends THREE.EventDispatcher{
this.viewer = viewer;
this.clipInside = false;
+ this.clipOffset = 0.1;
this.addEventListener("start_inserting_clipping_volume", e => {
this.viewer.dispatchEvent({
@@ -49,10 +50,19 @@ Potree.ClippingTool = class ClippingTool extends THREE.EventDispatcher{
}
setClipInside(inside) {
+ if(this.clipInside == inside) return;
+
this.clipInside = inside;
- viewer.dispatchEvent({"type": "clipper.clipInside_changed", "viewer": viewer});
+ viewer.dispatchEvent({"type": "clipper.clipInside_changed", "viewer": viewer, "inside": inside});
}
+ setClipOffset(offset) {
+ if(this.clipOffset == offset) return;
+
+ this.clipOffset = offset;
+ viewer.dispatchEvent({"type": "clipper.clipOffset_changed", "viewer": viewer, "offset": offset});
+ }
+
startInsertion(args = {}) {
let axis = -1;
if(args.axis + 1)
diff --git a/src/viewer/sidebar.js b/src/viewer/sidebar.js
index 1e239b02..50fd1dd4 100644
--- a/src/viewer/sidebar.js
+++ b/src/viewer/sidebar.js
@@ -1577,6 +1577,13 @@ function initClippingTool() {
+
+