@@ -86,6 +86,7 @@ const defaultOptions = {
86
86
focusOnMouseClick : true ,
87
87
handleCollision : true ,
88
88
minDistanceCollision : 30 ,
89
+ enableSmartTravel : true ,
89
90
} ;
90
91
91
92
export const PLANAR_CONTROL_EVENT = {
@@ -138,6 +139,7 @@ export const PLANAR_CONTROL_EVENT = {
138
139
* @param {boolean } [options.focusOnMouseOver=true] Set the focus on the canvas if hovered.
139
140
* @param {boolean } [options.focusOnMouseClick=true] Set the focus on the canvas if clicked.
140
141
* @param {boolean } [options.handleCollision=true]
142
+ * @param {boolean } [options.enableSmartTravel=true] enable smart travel
141
143
*/
142
144
class PlanarControls extends THREE . EventDispatcher {
143
145
constructor ( view , options = { } ) {
@@ -194,6 +196,9 @@ class PlanarControls extends THREE.EventDispatcher {
194
196
defaultOptions . handleCollision : options . handleCollision ;
195
197
this . minDistanceCollision = defaultOptions . minDistanceCollision ;
196
198
199
+ // enable smart travel
200
+ this . enableSmartTravel = options . enableSmartTravel === undefined ? defaultOptions . enableSmartTravel : options . enableSmartTravel ;
201
+
197
202
startPosition . copy ( this . camera . position ) ;
198
203
startQuaternion . copy ( this . camera . quaternion ) ;
199
204
@@ -854,7 +859,11 @@ class PlanarControls extends THREE.EventDispatcher {
854
859
this . initiateDrag ( ) ;
855
860
}
856
861
} else if ( mouseButtons . MIDDLECLICK === event . button ) {
857
- this . initiateSmartZoom ( ) ;
862
+ if ( this . enableSmartTravel ) {
863
+ this . initiateSmartZoom ( ) ;
864
+ } else {
865
+ return ;
866
+ }
858
867
} else if ( mouseButtons . RIGHTCLICK === event . button ) {
859
868
this . initiatePan ( ) ;
860
869
}
0 commit comments