-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ddaae1
commit f19bad9
Showing
3 changed files
with
36 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
MOUSE, | ||
TOUCH, | ||
} from 'three'; | ||
|
||
import { OrbitControls } from './OrbitControls.js'; | ||
|
||
// MapControls performs orbiting, dollying (zooming), and panning. | ||
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). | ||
// | ||
// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate | ||
// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish | ||
// Pan - left mouse, or arrow keys / touch: one-finger move | ||
|
||
class MapControls extends OrbitControls { | ||
|
||
constructor( object, domElement ) { | ||
|
||
super( object, domElement ); | ||
|
||
this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up | ||
|
||
this.mouseButtons.LEFT = MOUSE.PAN; | ||
this.mouseButtons.RIGHT = MOUSE.ROTATE; | ||
|
||
this.touches.ONE = TOUCH.PAN; | ||
this.touches.TWO = TOUCH.DOLLY_ROTATE; | ||
|
||
} | ||
|
||
} | ||
|
||
export { MapControls }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters