Browse Source

Editor: Solved problem of hotkeys interfering with input boxes. Rescued delete hotkey.

Mr.doob 12 years ago
parent
commit
ec51517e44
2 changed files with 22 additions and 0 deletions
  1. 16 0
      editor/index.html
  2. 6 0
      editor/js/libs/ui.js

+ 16 - 0
editor/index.html

@@ -194,6 +194,22 @@
 			sidebar.setBottom( '0px' );
 			document.body.appendChild( sidebar.dom );
 
+			//
+
+			document.addEventListener( 'keydown', function ( event ) {
+
+				switch ( event.keyCode ) {
+
+					case 46: // delete
+
+						signals.removeSelectedObject.dispatch();
+
+						break;
+
+					}
+
+			}, false );
+
 			var onWindowResize = function ( event ) {
 
 				signals.windowResize.dispatch();

+ 6 - 0
editor/js/libs/ui.js

@@ -162,6 +162,12 @@ UI.Input = function () {
 	dom.style.marginLeft = '-2px';
 	dom.style.border = '1px solid #ccc';
 
+	dom.addEventListener( 'keydown', function ( event ) {
+
+		event.stopPropagation();
+
+	}, false );
+
 	this.dom = dom;
 
 	return this;