Преглед на файлове

Add accessor functions for PointerDragBehavior._options

Popov72 преди 5 години
родител
ревизия
4a40c27a13
променени са 2 файла, в които са добавени 16 реда и са изтрити 0 реда
  1. 1 0
      dist/preview release/what's new.md
  2. 15 0
      src/Behaviors/Meshes/pointerDragBehavior.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -35,6 +35,7 @@
 - Display Oculus Quest controller when using a Quest in WebVR ([TrevorDev](https://github.com/TrevorDev))
 - Added startAndReleaseDragOnPointerEvents property to pointerDragBehavior which can be set to false for custom drag triggering ([TrevorDev](https://github.com/TrevorDev))
 - Added optional picking predicate to pointerDragBehavior for filtering affected meshes ([Exolun](https://github.com/Exolun))
+- Added accessor functions for `PointerDragBehavior._options` ([Popov72](https://github.com/Popov72))
 - Effect renderer to render one or multiple shader effects to a texture ([TrevorDev](https://github.com/TrevorDev))
 - Added url parameters to web request modifiers ([PierreLeBlond](https://github.com/PierreLeBlond))
 - Added `VRExperienceHelper.exitVROnDoubleTap` ([Deltakosh](https://github.com/deltakosh/))

+ 15 - 0
src/Behaviors/Meshes/pointerDragBehavior.ts

@@ -98,6 +98,21 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
     public useObjectOrienationForDragging = true;
 
     private _options: { dragAxis?: Vector3, dragPlaneNormal?: Vector3 };
+
+    /**
+     * Gets the options used by the behavior
+     */
+    public get options(): { dragAxis?: Vector3, dragPlaneNormal?: Vector3 } {
+        return this._options;
+    }
+
+    /**
+     * Sets the options used by the behavior
+     */
+    public set options(options: { dragAxis?: Vector3, dragPlaneNormal?: Vector3 }) {
+        this._options = options;
+    }
+
     /**
      * Creates a pointer drag behavior that can be attached to a mesh
      * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)