|
@@ -142,8 +142,9 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
|
|
/**
|
|
/**
|
|
* Attaches the drag behavior the passed in mesh
|
|
* Attaches the drag behavior the passed in mesh
|
|
* @param ownerNode The mesh that will be dragged around once attached
|
|
* @param ownerNode The mesh that will be dragged around once attached
|
|
|
|
+ * @param predicate Predicate to use for pick filtering
|
|
*/
|
|
*/
|
|
- public attach(ownerNode: AbstractMesh): void {
|
|
|
|
|
|
+ public attach(ownerNode: AbstractMesh, predicate?: (m: AbstractMesh) => boolean): void {
|
|
this._scene = ownerNode.getScene();
|
|
this._scene = ownerNode.getScene();
|
|
this.attachedNode = ownerNode;
|
|
this.attachedNode = ownerNode;
|
|
|
|
|
|
@@ -165,7 +166,7 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
|
|
// State of the drag
|
|
// State of the drag
|
|
this.lastDragPosition = new Vector3(0, 0, 0);
|
|
this.lastDragPosition = new Vector3(0, 0, 0);
|
|
|
|
|
|
- var pickPredicate = (m: AbstractMesh) => {
|
|
|
|
|
|
+ var pickPredicate = !!predicate ? predicate : (m: AbstractMesh) => {
|
|
return this.attachedNode == m || m.isDescendantOf(this.attachedNode);
|
|
return this.attachedNode == m || m.isDescendantOf(this.attachedNode);
|
|
};
|
|
};
|
|
|
|
|