提交 bf6c2505 编写于 作者: M Mr.doob

Editor/UI: Scripts can now be removed.

上级 b9f0c866
......@@ -13,11 +13,33 @@ UI.ScriptEditor = function () {
var event = new UI.Text( '' );
this.add( event );
var remove = new UI.Text( 'x' );
remove.setPosition( 'absolute' );
remove.setRight( '8px' );
remove.setCursor( 'pointer' );
remove.onClick( function () {
if ( confirm( 'Are you sure?' ) ) {
scope.parent.remove( scope );
if ( scope.onChangeCallback !== undefined ) {
scope.onChangeCallback();
}
}
} );
this.add( remove );
this.add( new UI.Break() );
var textarea = new UI.TextArea();
textarea.setWidth( '100%' );
textarea.setHeight( '100px' );
textarea.setMarginTop( '8px' );
textarea.onKeyUp( function () {
clearTimeout( timeout );
......
......@@ -100,6 +100,8 @@ UI.Panel = function () {
dom.className = 'Panel';
this.dom = dom;
this.parent = null;
this.children = [];
return this;
......@@ -119,6 +121,8 @@ UI.Panel.prototype.add = function () {
this.dom.appendChild( argument.dom );
this.children.push( argument );
argument.parent = this;
} else {
console.error( 'UI.Panel:', argument, 'is not an instance of UI.Element.' )
......@@ -150,6 +154,8 @@ UI.Panel.prototype.remove = function () {
}
argument.parent = null;
} else {
console.error( 'UI.Panel:', argument, 'is not an instance of UI.Element.' )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册