提交 5f55d09e 编写于 作者: M Mugen87

Editor: Make decimal precision on export configurable.

上级 83487e58
......@@ -8,6 +8,7 @@ var Config = function () {
var storage = {
'language': 'en',
'exportPrecision': 6,
'autosave': true,
......
......@@ -14,11 +14,11 @@ import { UIPanel, UIRow, UIHorizontalRule } from './libs/ui.js';
var MenubarFile = function ( editor ) {
var NUMBER_PRECISION = 6;
function parseNumber( key, value ) {
return typeof value === 'number' ? parseFloat( value.toFixed( NUMBER_PRECISION ) ) : value;
var precision = config.getKey( 'exportPrecision' );
return typeof value === 'number' ? parseFloat( value.toFixed( precision ) ) : value;
}
......
......@@ -2,7 +2,7 @@
* @author mrdoob / http://mrdoob.com/
*/
import { UIPanel, UIRow, UISelect, UIText } from './libs/ui.js';
import { UIPanel, UIRow, UISelect, UIText, UIInteger } from './libs/ui.js';
import { SidebarSettingsViewport } from './Sidebar.Settings.Viewport.js';
import { SidebarSettingsShortcuts } from './Sidebar.Settings.Shortcuts.js';
......@@ -47,6 +47,26 @@ var SidebarSettings = function ( editor ) {
container.add( languageRow );
// export precision
var exportPrecisionRow = new UIRow();
var exportPrecision = new UIInteger( config.getKey( 'exportPrecision' ) ).setRange( 2, Infinity );
exportPrecision.onChange( function () {
var value = this.getValue();
editor.config.setKey( 'exportPrecision', value );
} );
exportPrecisionRow.add( new UIText( strings.getKey( 'sidebar/settings/exportPrecision' ) ).setWidth( '90px' ) );
exportPrecisionRow.add( exportPrecision );
container.add( exportPrecisionRow );
//
container.add( new SidebarSettingsShortcuts( editor ) );
container.add( new SidebarSettingsViewport( editor ) );
......
......@@ -295,6 +295,7 @@ var Strings = function ( config ) {
'sidebar/settings': 'Settings',
'sidebar/settings/language': 'Language',
'sidebar/settings/exportPrecision': 'Export Precision',
'sidebar/settings/shortcuts/translate': 'Translate',
'sidebar/settings/shortcuts/rotate': 'Rotate',
......@@ -580,6 +581,7 @@ var Strings = function ( config ) {
'sidebar/settings': '设置',
'sidebar/settings/language': '语言',
'sidebar/settings/exportPrecision': 'Export Precision',
'sidebar/settings/shortcuts/translate': '移动',
'sidebar/settings/shortcuts/rotate': '旋转',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册