mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
fix linting
This commit is contained in:
parent
aa62c77ccf
commit
ac759c9f01
@ -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;
|
||||
|
@ -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)
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -241,7 +241,6 @@ class ColorController extends Controller {
|
||||
|
||||
_this.setValue(_this.__color.toOriginal());
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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] });
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user