Browse Source

SelectionHelper: Add enabled property. (#26483)

puxiao 2 years ago
parent
commit
11b7b5c1ac
1 changed files with 7 additions and 0 deletions
  1. 7 0
      examples/jsm/interactive/SelectionHelper.js

+ 7 - 0
examples/jsm/interactive/SelectionHelper.js

@@ -15,9 +15,12 @@ class SelectionHelper {
 		this.pointBottomRight = new Vector2();
 		this.pointBottomRight = new Vector2();
 
 
 		this.isDown = false;
 		this.isDown = false;
+		this.enabled = true;
 
 
 		this.onPointerDown = function ( event ) {
 		this.onPointerDown = function ( event ) {
 
 
+			if ( this.enabled === false ) return;
+
 			this.isDown = true;
 			this.isDown = true;
 			this.onSelectStart( event );
 			this.onSelectStart( event );
 
 
@@ -25,6 +28,8 @@ class SelectionHelper {
 
 
 		this.onPointerMove = function ( event ) {
 		this.onPointerMove = function ( event ) {
 
 
+			if ( this.enabled === false ) return;
+
 			if ( this.isDown ) {
 			if ( this.isDown ) {
 
 
 				this.onSelectMove( event );
 				this.onSelectMove( event );
@@ -35,6 +40,8 @@ class SelectionHelper {
 
 
 		this.onPointerUp = function ( ) {
 		this.onPointerUp = function ( ) {
 
 
+			if ( this.enabled === false ) return;
+
 			this.isDown = false;
 			this.isDown = false;
 			this.onSelectOver();
 			this.onSelectOver();