Преглед на файлове

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

Mr.doob преди 12 години
родител
ревизия
ec51517e44
променени са 2 файла, в които са добавени 22 реда и са изтрити 0 реда
  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' );
 			sidebar.setBottom( '0px' );
 			document.body.appendChild( sidebar.dom );
 			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 ) {
 			var onWindowResize = function ( event ) {
 
 
 				signals.windowResize.dispatch();
 				signals.windowResize.dispatch();

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

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