feat(viewer): selection utils: esc clears selection

This commit is contained in:
Dimitrie Stefanescu
2021-01-19 22:07:43 +00:00
parent 5428bab9f4
commit a26cf1ce3b
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -1427,6 +1427,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
* - Clicking on one object will select it.
* - Double clicking on one object will focus on it.
* - Double clicking anywhere else will focus the scene.
* - Pressing escape will clear any selection present.
* TODOs:
* - Ensure clipped geometry is not selected.
* - When objects are disposed, ensure selection is reset.
@@ -1514,6 +1515,7 @@ var SelectionHelper = /*#__PURE__*/function (_EventEmitter) {
document.addEventListener('keydown', e => {
if (e.isComposing || e.keyCode === 229) return;
if (e.key === 'Shift') _this.multiSelect = true;
if (e.key === 'Escape') _this.unselect();
});
document.addEventListener('keyup', e => {
if (e.isComposing || e.keyCode === 229) return;
@@ -8,6 +8,7 @@ import EventEmitter from './EventEmitter'
* - Clicking on one object will select it.
* - Double clicking on one object will focus on it.
* - Double clicking anywhere else will focus the scene.
* - Pressing escape will clear any selection present.
* TODOs:
* - Ensure clipped geometry is not selected.
* - When objects are disposed, ensure selection is reset.
@@ -71,6 +72,7 @@ export default class SelectionHelper extends EventEmitter {
document.addEventListener( 'keydown', ( e ) => {
if ( e.isComposing || e.keyCode === 229 ) return
if ( e.key === 'Shift' ) this.multiSelect = true
if ( e.key === 'Escape' ) this.unselect( )
} )
document.addEventListener( 'keyup', ( e ) => {
if ( e.isComposing || e.keyCode === 229 ) return