|
@@ -105304,6 +105304,9 @@ var BABYLON;
|
|
|
*/
|
|
|
_this.scalePivot = null;
|
|
|
_this._existingMeshScale = new BABYLON.Vector3();
|
|
|
+ // Dragging
|
|
|
+ _this._dragMesh = null;
|
|
|
+ _this.pointerDragBehavior = new BABYLON.PointerDragBehavior();
|
|
|
// Do not update the gizmo's scale so it has a fixed size to the object its attached to
|
|
|
_this._updateScale = false;
|
|
|
_this._anchorMesh = new BABYLON.AbstractMesh("anchor", gizmoLayer.utilityLayerScene);
|
|
@@ -105394,6 +105397,7 @@ var BABYLON;
|
|
|
_this.updateBoundingBox();
|
|
|
BoundingBoxGizmo._RestorePivotPoint(_this.attachedMesh);
|
|
|
}
|
|
|
+ _this._updateDummy();
|
|
|
});
|
|
|
// Selection/deselection
|
|
|
_dragBehavior.onDragStartObservable.add(function () {
|
|
@@ -105403,6 +105407,7 @@ var BABYLON;
|
|
|
_dragBehavior.onDragEndObservable.add(function () {
|
|
|
_this.onRotationSphereDragEndObservable.notifyObservers({});
|
|
|
_this._selectNode(null);
|
|
|
+ _this._updateDummy();
|
|
|
});
|
|
|
this_1._rotateSpheresParent.addChild(sphere);
|
|
|
};
|
|
@@ -105455,6 +105460,7 @@ var BABYLON;
|
|
|
_this._anchorMesh.removeChild(_this.attachedMesh);
|
|
|
BoundingBoxGizmo._RestorePivotPoint(_this.attachedMesh);
|
|
|
}
|
|
|
+ _this._updateDummy();
|
|
|
});
|
|
|
// Selection/deselection
|
|
|
_dragBehavior.onDragStartObservable.add(function () {
|
|
@@ -105464,6 +105470,7 @@ var BABYLON;
|
|
|
_dragBehavior.onDragEndObservable.add(function () {
|
|
|
_this.onScaleBoxDragEndObservable.notifyObservers({});
|
|
|
_this._selectNode(null);
|
|
|
+ _this._updateDummy();
|
|
|
});
|
|
|
this_2._scaleBoxesParent.addChild(box);
|
|
|
};
|
|
@@ -105502,6 +105509,11 @@ var BABYLON;
|
|
|
_this._updateRotationSpheres();
|
|
|
_this._updateScaleBoxes();
|
|
|
}
|
|
|
+ // If dragg mesh is enabled and dragging, update the attached mesh pose to match the drag mesh
|
|
|
+ if (_this._dragMesh && _this.attachedMesh && _this.pointerDragBehavior.dragging) {
|
|
|
+ _this._lineBoundingBox.position.rotateByQuaternionToRef(_this._rootMesh.rotationQuaternion, _this._tmpVector);
|
|
|
+ _this.attachedMesh.setAbsolutePosition(_this._dragMesh.position.add(_this._tmpVector.scale(-1)));
|
|
|
+ }
|
|
|
});
|
|
|
_this.updateBoundingBox();
|
|
|
return _this;
|
|
@@ -105534,6 +105546,7 @@ var BABYLON;
|
|
|
this._PivotCached--;
|
|
|
};
|
|
|
BoundingBoxGizmo.prototype._attachedMeshChanged = function (value) {
|
|
|
+ var _this = this;
|
|
|
if (value) {
|
|
|
// Reset anchor mesh to match attached mesh's scale
|
|
|
// This is needed to avoid invalid box/sphere position on first drag
|
|
@@ -105542,6 +105555,9 @@ var BABYLON;
|
|
|
this._anchorMesh.removeChild(value);
|
|
|
BoundingBoxGizmo._RestorePivotPoint(value);
|
|
|
this.updateBoundingBox();
|
|
|
+ this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function () {
|
|
|
+ _this._updateDummy();
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
BoundingBoxGizmo.prototype._selectNode = function (selectedMesh) {
|
|
@@ -105663,6 +105679,23 @@ var BABYLON;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
+ BoundingBoxGizmo.prototype._updateDummy = function () {
|
|
|
+ if (this._dragMesh) {
|
|
|
+ this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition());
|
|
|
+ this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling);
|
|
|
+ this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Enables a pointer drag behavior on the bounding box of the gizmo
|
|
|
+ */
|
|
|
+ BoundingBoxGizmo.prototype.enableDragBehavior = function () {
|
|
|
+ this._dragMesh = BABYLON.Mesh.CreateBox("dummy", 1, this.gizmoLayer.utilityLayerScene);
|
|
|
+ this._dragMesh.visibility = 0;
|
|
|
+ this._dragMesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
+ this.pointerDragBehavior.useObjectOrienationForDragging = false;
|
|
|
+ this._dragMesh.addBehavior(this.pointerDragBehavior);
|
|
|
+ };
|
|
|
/**
|
|
|
* Disposes of the gizmo
|
|
|
*/
|
|
@@ -105672,6 +105705,9 @@ var BABYLON;
|
|
|
this._lineBoundingBox.dispose();
|
|
|
this._rotateSpheresParent.dispose();
|
|
|
this._scaleBoxesParent.dispose();
|
|
|
+ if (this._dragMesh) {
|
|
|
+ this._dragMesh.dispose();
|
|
|
+ }
|
|
|
_super.prototype.dispose.call(this);
|
|
|
};
|
|
|
/**
|