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

Editor: Only show toolbar when a object is selected.

上级 71306484
......@@ -53,7 +53,7 @@ select {
top: 32px;
left: 0;
right: 300px;
bottom: 32px;
bottom: 0px;
}
#viewport #info {
......@@ -201,9 +201,9 @@ select {
#toolbar {
position: absolute;
left: 0;
right: 300px;
bottom: 0;
left: calc(50% - 290px); /* ( ( 100% - 300px ) / 2.0 ) - 140px */
width: 280px;
bottom: 16px;
height: 32px;
background-color: #111;
color: #333;
......
......@@ -49,7 +49,7 @@ select {
top: 32px;
left: 0;
right: 300px;
bottom: 32px;
bottom: 0px;
}
#viewport #info {
......@@ -194,9 +194,9 @@ select {
#toolbar {
position: absolute;
left: 0;
right: 300px;
bottom: 0;
left: calc(50% - 290px); /* ( ( 100% - 300px ) / 2.0 ) - 140px */
width: 280px;
bottom: 16px;
height: 32px;
background: #eee;
color: #333;
......
......@@ -8,6 +8,7 @@ var Toolbar = function ( editor ) {
var container = new UI.Panel();
container.setId( 'toolbar' );
container.setDisplay( 'none' );
var buttons = new UI.Panel();
container.add( buttons );
......@@ -15,7 +16,6 @@ var Toolbar = function ( editor ) {
// translate / rotate / scale
var translate = new UI.Button( 'translate' );
translate.dom.title = 'W';
translate.dom.className = 'Button selected';
translate.onClick( function () {
......@@ -25,7 +25,6 @@ var Toolbar = function ( editor ) {
buttons.add( translate );
var rotate = new UI.Button( 'rotate' );
rotate.dom.title = 'E';
rotate.onClick( function () {
signals.transformModeChanged.dispatch( 'rotate' );
......@@ -34,7 +33,6 @@ var Toolbar = function ( editor ) {
buttons.add( rotate );
var scale = new UI.Button( 'scale' );
scale.dom.title = 'R';
scale.onClick( function () {
signals.transformModeChanged.dispatch( 'scale' );
......@@ -50,6 +48,14 @@ var Toolbar = function ( editor ) {
} );
buttons.add( local );
//
signals.objectSelected.add( function ( object ) {
container.setDisplay( object === null ? 'none' : '' );
} );
signals.transformModeChanged.add( function ( mode ) {
translate.dom.classList.remove( 'selected' );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册