From a501950082d00f063507e0913ae623408981a2e1 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Sun, 7 Feb 2021 16:53:06 +0000 Subject: [PATCH] Editor: Settings clean up. --- ...idebar.History.js => Sidebar.Settings.History.js} | 4 ++-- editor/js/Sidebar.Settings.Shortcuts.js | 12 ++++++++---- editor/js/Sidebar.Settings.js | 1 - editor/js/Sidebar.js | 6 ++++-- editor/js/Strings.js | 3 +++ editor/sw.js | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-) rename editor/js/{Sidebar.History.js => Sidebar.Settings.History.js} (97%) diff --git a/editor/js/Sidebar.History.js b/editor/js/Sidebar.Settings.History.js similarity index 97% rename from editor/js/Sidebar.History.js rename to editor/js/Sidebar.Settings.History.js index 4e9729ceee11bf..bcf998c24570b8 100644 --- a/editor/js/Sidebar.History.js +++ b/editor/js/Sidebar.Settings.History.js @@ -2,7 +2,7 @@ import { UIPanel, UIBreak, UIText } from './libs/ui.js'; import { UIBoolean, UIOutliner } from './libs/ui.three.js'; -function SidebarHistory( editor ) { +function SidebarSettingsHistory( editor ) { var strings = editor.strings; @@ -130,4 +130,4 @@ function SidebarHistory( editor ) { } -export { SidebarHistory }; +export { SidebarSettingsHistory }; diff --git a/editor/js/Sidebar.Settings.Shortcuts.js b/editor/js/Sidebar.Settings.Shortcuts.js index d445654cb9b78b..1e5a4d8a48fdd2 100644 --- a/editor/js/Sidebar.Settings.Shortcuts.js +++ b/editor/js/Sidebar.Settings.Shortcuts.js @@ -1,4 +1,4 @@ -import { UIDiv, UIBreak, UIText, UIRow, UIInput } from './libs/ui.js'; +import { UIPanel, UIText, UIRow, UIInput } from './libs/ui.js'; import { RemoveObjectCommand } from './commands/RemoveObjectCommand.js'; @@ -17,8 +17,11 @@ function SidebarSettingsShortcuts( editor ) { var config = editor.config; var signals = editor.signals; - var container = new UIDiv(); - container.add( new UIBreak() ); + var container = new UIPanel(); + + var headerRow = new UIRow(); + headerRow.add( new UIText( strings.getKey( 'sidebar/settings/shortcuts' ).toUpperCase() ) ); + container.add( headerRow ); var shortcuts = [ 'translate', 'rotate', 'scale', 'undo', 'focus' ]; @@ -27,7 +30,8 @@ function SidebarSettingsShortcuts( editor ) { var configName = 'settings/shortcuts/' + name; var shortcutRow = new UIRow(); - var shortcutInput = new UIInput().setWidth( '150px' ).setFontSize( '12px' ); + var shortcutInput = new UIInput().setWidth( '15px' ).setFontSize( '12px' ); + shortcutInput.setTextAlign( 'center' ); shortcutInput.setTextTransform( 'lowercase' ); shortcutInput.onChange( function () { diff --git a/editor/js/Sidebar.Settings.js b/editor/js/Sidebar.Settings.js index 40e9ecb69d8803..2c3d73d54af7a0 100644 --- a/editor/js/Sidebar.Settings.js +++ b/editor/js/Sidebar.Settings.js @@ -64,7 +64,6 @@ function SidebarSettings( editor ) { // - container.add( new SidebarSettingsShortcuts( editor ) ); container.add( new SidebarSettingsViewport( editor ) ); return container; diff --git a/editor/js/Sidebar.js b/editor/js/Sidebar.js index ac61af3ca7078b..745d1f905772f3 100644 --- a/editor/js/Sidebar.js +++ b/editor/js/Sidebar.js @@ -5,8 +5,9 @@ import { SidebarProperties } from './Sidebar.Properties.js'; import { SidebarScript } from './Sidebar.Script.js'; import { SidebarAnimation } from './Sidebar.Animation.js'; import { SidebarProject } from './Sidebar.Project.js'; -import { SidebarHistory } from './Sidebar.History.js'; import { SidebarSettings } from './Sidebar.Settings.js'; +import { SidebarSettingsShortcuts } from './Sidebar.Settings.Shortcuts.js'; +import { SidebarSettingsHistory } from './Sidebar.Settings.History.js'; function Sidebar( editor ) { @@ -26,7 +27,8 @@ function Sidebar( editor ) { var settings = new UISpan().add( new SidebarSettings( editor ), - new SidebarHistory( editor ) + new SidebarSettingsShortcuts( editor ), + new SidebarSettingsHistory( editor ) ); container.addTab( 'scene', strings.getKey( 'sidebar/scene' ), scene ); diff --git a/editor/js/Strings.js b/editor/js/Strings.js index 8d305de6eff527..b40c7da90490c2 100644 --- a/editor/js/Strings.js +++ b/editor/js/Strings.js @@ -304,6 +304,7 @@ function Strings( config ) { 'sidebar/settings/language': 'Language', 'sidebar/settings/exportPrecision': 'Export Precision', + 'sidebar/settings/shortcuts': 'Shortcuts', 'sidebar/settings/shortcuts/translate': 'Translate', 'sidebar/settings/shortcuts/rotate': 'Rotate', 'sidebar/settings/shortcuts/scale': 'Scale', @@ -628,6 +629,7 @@ function Strings( config ) { 'sidebar/settings/language': 'Langue', 'sidebar/settings/exportPrecision': 'Précision à l\'exportation', + 'sidebar/settings/shortcuts': 'Shortcuts', 'sidebar/settings/shortcuts/translate': 'Position', 'sidebar/settings/shortcuts/rotate': 'Rotation', 'sidebar/settings/shortcuts/scale': 'Échelle', @@ -936,6 +938,7 @@ function Strings( config ) { 'sidebar/settings/language': '语言', 'sidebar/settings/exportPrecision': '输出精度', + 'sidebar/settings/shortcuts': 'Shortcuts', 'sidebar/settings/shortcuts/translate': '移动', 'sidebar/settings/shortcuts/rotate': '旋转', 'sidebar/settings/shortcuts/scale': '缩放', diff --git a/editor/sw.js b/editor/sw.js index 1ebe55119209b2..789d2d370d10dc 100644 --- a/editor/sw.js +++ b/editor/sw.js @@ -135,6 +135,7 @@ const assets = [ './js/Sidebar.Project.Materials.js', './js/Sidebar.Project.Renderer.js', './js/Sidebar.Settings.js', + './js/Sidebar.Settings.History.js', './js/Sidebar.Settings.Shortcuts.js', './js/Sidebar.Settings.Viewport.js', './js/Sidebar.Properties.js', @@ -162,7 +163,6 @@ const assets = [ './js/Sidebar.Material.js', './js/Sidebar.Animation.js', './js/Sidebar.Script.js', - './js/Sidebar.History.js', './js/Strings.js', './js/Toolbar.js', './js/Viewport.js',