Explorar o código

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

Mr.doob %!s(int64=12) %!d(string=hai) anos
pai
achega
ec51517e44
Modificáronse 2 ficheiros con 22 adicións e 0 borrados
  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;