diff --git a/src/dat/color/Color.js b/src/dat/color/Color.js index bd357d7..274f69a 100644 --- a/src/dat/color/Color.js +++ b/src/dat/color/Color.js @@ -86,7 +86,6 @@ function defineHSVComponent(target, component) { }); } - Color.recalculateRGB = function(color, component, componentHexIndex) { if (color.__state.space === 'HEX') { color.__state[component] = math.component_from_hex(color.__state.hex, componentHexIndex); @@ -100,11 +99,13 @@ Color.recalculateRGB = function(color, component, componentHexIndex) { Color.recalculateHSV = function(color) { const result = math.rgb_to_hsv(color.r, color.g, color.b); - common.extend(color.__state, + common.extend( + color.__state, { s: result.s, v: result.v - }); + } + ); if (!common.isNaN(result.h)) { color.__state.h = result.h; diff --git a/src/dat/color/interpret.js b/src/dat/color/interpret.js index a4564d1..b24a3d2 100644 --- a/src/dat/color/interpret.js +++ b/src/dat/color/interpret.js @@ -28,12 +28,10 @@ const INTERPRETATIONS = [ return { space: 'HEX', - hex: parseInt( - '0x' + + hex: parseInt('0x' + test[1].toString() + test[1].toString() + test[2].toString() + test[2].toString() + - test[3].toString() + test[3].toString(), 0 - ) + test[3].toString() + test[3].toString(), 16) }; }, @@ -49,7 +47,7 @@ const INTERPRETATIONS = [ return { space: 'HEX', - hex: parseInt('0x' + test[1].toString(), 0) + hex: parseInt('0x' + test[1].toString(), 16) }; }, diff --git a/src/dat/controllers/ColorController.js b/src/dat/controllers/ColorController.js index bef82da..404a71d 100644 --- a/src/dat/controllers/ColorController.js +++ b/src/dat/controllers/ColorController.js @@ -241,7 +241,6 @@ class ColorController extends Controller { _this.setValue(_this.__color.toOriginal()); - return false; } diff --git a/src/dat/controllers/ControllerFactory.js b/src/dat/controllers/ControllerFactory.js index a62af87..d22d88d 100644 --- a/src/dat/controllers/ControllerFactory.js +++ b/src/dat/controllers/ControllerFactory.js @@ -33,8 +33,13 @@ const ControllerFactory = function(object, property) { if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) { // has step? if (common.isNumber(arguments[4])) { - return new NumberControllerSlider(object, property, - arguments[2], arguments[3], arguments[4]); + return new NumberControllerSlider( + object, + property, + arguments[2], + arguments[3], + arguments[4] + ); } return new NumberControllerSlider(object, property, arguments[2], arguments[3]); @@ -42,8 +47,11 @@ const ControllerFactory = function(object, property) { // number box if (common.isNumber(arguments[4])) { // has step - return new NumberControllerBox(object, property, - { min: arguments[2], max: arguments[3], step: arguments[4] }); + return new NumberControllerBox( + object, + property, + { min: arguments[2], max: arguments[3], step: arguments[4] } + ); } return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] }); } diff --git a/src/dat/controllers/NumberController.js b/src/dat/controllers/NumberController.js index 02c7919..e08ba64 100644 --- a/src/dat/controllers/NumberController.js +++ b/src/dat/controllers/NumberController.js @@ -50,7 +50,7 @@ class NumberController extends Controller { this.__impliedStep = 1; // What are we, psychics? } else { // Hey Doug, check this out. - this.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(this.initialValue)) / Math.LN10)) / 10; + this.__impliedStep = 10 ** Math.floor(Math.log(Math.abs(this.initialValue)) / Math.LN10) / 10; } } else { this.__impliedStep = this.__step; diff --git a/src/dat/controllers/NumberControllerBox.js b/src/dat/controllers/NumberControllerBox.js index 3cc4523..e1cd573 100644 --- a/src/dat/controllers/NumberControllerBox.js +++ b/src/dat/controllers/NumberControllerBox.js @@ -16,7 +16,7 @@ import dom from '../dom/dom'; import common from '../utils/common'; function roundToDecimal(value, decimals) { - const tenTo = Math.pow(10, decimals); + const tenTo = 10 ** decimals; return Math.round(value * tenTo) / tenTo; } diff --git a/src/dat/dom/CenteredDiv.js b/src/dat/dom/CenteredDiv.js index c12fba9..532f371 100644 --- a/src/dat/dom/CenteredDiv.js +++ b/src/dat/dom/CenteredDiv.js @@ -41,7 +41,6 @@ class CenteredDiv { transition: 'transform 0.2s ease-out, opacity 0.2s linear' }); - document.body.appendChild(this.backgroundElement); document.body.appendChild(this.domElement); diff --git a/src/dat/dom/dom.js b/src/dat/dom/dom.js index dcce013..c7798df 100644 --- a/src/dat/dom/dom.js +++ b/src/dat/dom/dom.js @@ -116,13 +116,23 @@ const dom = { { const clientX = params.x || params.clientX || 0; const clientY = params.y || params.clientY || 0; - evt.initMouseEvent(eventType, params.bubbles || false, - params.cancelable || true, window, params.clickCount || 1, + evt.initMouseEvent( + eventType, + params.bubbles || false, + params.cancelable || true, + window, + params.clickCount || 1, 0, // screen X 0, // screen Y clientX, // client X clientY, // client Y - false, false, false, false, 0, null); + false, + false, + false, + false, + 0, + null + ); break; } case 'KeyboardEvents': @@ -137,11 +147,18 @@ const dom = { keyCode: undefined, charCode: undefined }); - init(eventType, params.bubbles || false, - params.cancelable, window, - params.ctrlKey, params.altKey, - params.shiftKey, params.metaKey, - params.keyCode, params.charCode); + init( + eventType, + params.bubbles || false, + params.cancelable, + window, + params.ctrlKey, + params.altKey, + params.shiftKey, + params.metaKey, + params.keyCode, + params.charCode + ); break; } default: diff --git a/src/dat/gui/GUI.js b/src/dat/gui/GUI.js index dbf1ae6..48e9ffe 100644 --- a/src/dat/gui/GUI.js +++ b/src/dat/gui/GUI.js @@ -179,7 +179,8 @@ const GUI = function(pars) { let saveToLocalStorage; let titleRow; - Object.defineProperties(this, + Object.defineProperties( + this, /** @lends GUI.prototype */ { /** @@ -332,7 +333,8 @@ const GUI = function(pars) { } } } - }); + } + ); // Are we a root level GUI? if (common.isUndefined(params.parent)) { @@ -412,7 +414,6 @@ const GUI = function(pars) { dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE); } - // Make it not elastic. if (!this.parent) { setWidth(_this, params.width); @@ -698,7 +699,6 @@ common.extend( this.domElement.style.display = ''; }, - onResize: function() { // we debounce this function to prevent performance issues when rotating on tablet/mobile const root = this.getRoot(); @@ -991,8 +991,11 @@ function augmentController(gui, li, controller) { // All sliders should be accompanied by a box. if (controller instanceof NumberControllerSlider) { - const box = new NumberControllerBox(controller.object, controller.property, - { min: controller.__min, max: controller.__max, step: controller.__step }); + const box = new NumberControllerBox( + controller.object, + controller.property, + { min: controller.__min, max: controller.__max, step: controller.__step } + ); common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function(method) { const pc = controller[method];