Skip to content

Commit

Permalink
Editor: Improved Background UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 20, 2020
1 parent 1af3252 commit 18439fe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 36 deletions.
7 changes: 7 additions & 0 deletions editor/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ input {
vertical-align: middle;
}

input[type="color"]::-webkit-color-swatch-wrapper {
padding: 0;
}
input[type="color"]::-webkit-color-swatch {
border: none;
}

textarea {
tab-size: 4;
white-space: pre;
Expand Down
48 changes: 14 additions & 34 deletions editor/js/Sidebar.Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function SidebarScene( editor ) {
'None': 'None',
'Color': 'Color',
'Texture': 'Texture',
'Equirectangular': 'Equirectangular'
'Equirectangular': 'Equirect'

} ).setWidth( '150px' );
backgroundType.onChange( function () {
Expand All @@ -187,49 +187,29 @@ function SidebarScene( editor ) {
backgroundRow.add( new UIText( strings.getKey( 'sidebar/scene/background' ) ).setWidth( '90px' ) );
backgroundRow.add( backgroundType );

container.add( backgroundRow );

//

var colorRow = new UIRow();
colorRow.setMarginLeft( '90px' );

var backgroundColor = new UIColor().setValue( '#000000' ).onChange( onBackgroundChanged );
colorRow.add( backgroundColor );

container.add( colorRow );

//

var textureRow = new UIRow();
textureRow.setDisplay( 'none' );
textureRow.setMarginLeft( '90px' );
var backgroundColor = new UIColor().setValue( '#000000' ).setMarginLeft( '8px' ).onChange( onBackgroundChanged );
backgroundRow.add( backgroundColor );

var backgroundTexture = new UITexture().onChange( onBackgroundChanged );
textureRow.add( backgroundTexture );
var backgroundTexture = new UITexture().setMarginLeft( '8px' ).onChange( onBackgroundChanged );
backgroundTexture.setDisplay( 'none' );
backgroundRow.add( backgroundTexture );

container.add( textureRow );

//
var backgroundEquirectangularTexture = new UITexture().setMarginLeft( '8px' ).onChange( onBackgroundChanged );
backgroundEquirectangularTexture.setDisplay( 'none' );
backgroundRow.add( backgroundEquirectangularTexture );

var equirectangularRow = new UIRow();
equirectangularRow.setDisplay( 'none' );
equirectangularRow.setMarginLeft( '90px' );

var backgroundEquirectangularTexture = new UITexture().onChange( onBackgroundChanged );
equirectangularRow.add( backgroundEquirectangularTexture );

container.add( equirectangularRow );
container.add( backgroundRow );

//

function refreshBackgroundUI() {

var type = backgroundType.getValue();

colorRow.setDisplay( type === 'Color' ? '' : 'none' );
textureRow.setDisplay( type === 'Texture' ? '' : 'none' );
equirectangularRow.setDisplay( type === 'Equirectangular' ? '' : 'none' );
backgroundType.setWidth( type === 'None' ? '150px' : '110px' );
backgroundColor.setDisplay( type === 'Color' ? '' : 'none' );
backgroundTexture.setDisplay( type === 'Texture' ? '' : 'none' );
backgroundEquirectangularTexture.setDisplay( type === 'Equirectangular' ? '' : 'none' );

}

Expand Down
4 changes: 2 additions & 2 deletions editor/js/libs/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ function UIColor() {

var dom = document.createElement( 'input' );
dom.className = 'Color';
dom.style.width = '64px';
dom.style.height = '17px';
dom.style.width = '32px';
dom.style.height = '16px';
dom.style.border = '0px';
dom.style.padding = '2px';
dom.style.backgroundColor = 'transparent';
Expand Down

0 comments on commit 18439fe

Please sign in to comment.