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) {
|
Color.recalculateRGB = function(color, component, componentHexIndex) {
|
||||||
if (color.__state.space === 'HEX') {
|
if (color.__state.space === 'HEX') {
|
||||||
color.__state[component] = math.component_from_hex(color.__state.hex, componentHexIndex);
|
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) {
|
Color.recalculateHSV = function(color) {
|
||||||
const result = math.rgb_to_hsv(color.r, color.g, color.b);
|
const result = math.rgb_to_hsv(color.r, color.g, color.b);
|
||||||
|
|
||||||
common.extend(color.__state,
|
common.extend(
|
||||||
|
color.__state,
|
||||||
{
|
{
|
||||||
s: result.s,
|
s: result.s,
|
||||||
v: result.v
|
v: result.v
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (!common.isNaN(result.h)) {
|
if (!common.isNaN(result.h)) {
|
||||||
color.__state.h = result.h;
|
color.__state.h = result.h;
|
||||||
|
@ -28,12 +28,10 @@ const INTERPRETATIONS = [
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
space: 'HEX',
|
space: 'HEX',
|
||||||
hex: parseInt(
|
hex: parseInt('0x' +
|
||||||
'0x' +
|
|
||||||
test[1].toString() + test[1].toString() +
|
test[1].toString() + test[1].toString() +
|
||||||
test[2].toString() + test[2].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 {
|
return {
|
||||||
space: 'HEX',
|
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());
|
_this.setValue(_this.__color.toOriginal());
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,13 @@ const ControllerFactory = function(object, property) {
|
|||||||
if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) {
|
if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) {
|
||||||
// has step?
|
// has step?
|
||||||
if (common.isNumber(arguments[4])) {
|
if (common.isNumber(arguments[4])) {
|
||||||
return new NumberControllerSlider(object, property,
|
return new NumberControllerSlider(
|
||||||
arguments[2], arguments[3], arguments[4]);
|
object,
|
||||||
|
property,
|
||||||
|
arguments[2],
|
||||||
|
arguments[3],
|
||||||
|
arguments[4]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
|
return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
|
||||||
@ -42,8 +47,11 @@ const ControllerFactory = function(object, property) {
|
|||||||
|
|
||||||
// number box
|
// number box
|
||||||
if (common.isNumber(arguments[4])) { // has step
|
if (common.isNumber(arguments[4])) { // has step
|
||||||
return new NumberControllerBox(object, property,
|
return new NumberControllerBox(
|
||||||
{ min: arguments[2], max: arguments[3], step: arguments[4] });
|
object,
|
||||||
|
property,
|
||||||
|
{ min: arguments[2], max: arguments[3], step: arguments[4] }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] });
|
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?
|
this.__impliedStep = 1; // What are we, psychics?
|
||||||
} else {
|
} else {
|
||||||
// Hey Doug, check this out.
|
// 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 {
|
} else {
|
||||||
this.__impliedStep = this.__step;
|
this.__impliedStep = this.__step;
|
||||||
|
@ -16,7 +16,7 @@ import dom from '../dom/dom';
|
|||||||
import common from '../utils/common';
|
import common from '../utils/common';
|
||||||
|
|
||||||
function roundToDecimal(value, decimals) {
|
function roundToDecimal(value, decimals) {
|
||||||
const tenTo = Math.pow(10, decimals);
|
const tenTo = 10 ** decimals;
|
||||||
return Math.round(value * tenTo) / tenTo;
|
return Math.round(value * tenTo) / tenTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ class CenteredDiv {
|
|||||||
transition: 'transform 0.2s ease-out, opacity 0.2s linear'
|
transition: 'transform 0.2s ease-out, opacity 0.2s linear'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
document.body.appendChild(this.backgroundElement);
|
document.body.appendChild(this.backgroundElement);
|
||||||
document.body.appendChild(this.domElement);
|
document.body.appendChild(this.domElement);
|
||||||
|
|
||||||
|
@ -116,13 +116,23 @@ const dom = {
|
|||||||
{
|
{
|
||||||
const clientX = params.x || params.clientX || 0;
|
const clientX = params.x || params.clientX || 0;
|
||||||
const clientY = params.y || params.clientY || 0;
|
const clientY = params.y || params.clientY || 0;
|
||||||
evt.initMouseEvent(eventType, params.bubbles || false,
|
evt.initMouseEvent(
|
||||||
params.cancelable || true, window, params.clickCount || 1,
|
eventType,
|
||||||
|
params.bubbles || false,
|
||||||
|
params.cancelable || true,
|
||||||
|
window,
|
||||||
|
params.clickCount || 1,
|
||||||
0, // screen X
|
0, // screen X
|
||||||
0, // screen Y
|
0, // screen Y
|
||||||
clientX, // client X
|
clientX, // client X
|
||||||
clientY, // client Y
|
clientY, // client Y
|
||||||
false, false, false, false, 0, null);
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
null
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'KeyboardEvents':
|
case 'KeyboardEvents':
|
||||||
@ -137,11 +147,18 @@ const dom = {
|
|||||||
keyCode: undefined,
|
keyCode: undefined,
|
||||||
charCode: undefined
|
charCode: undefined
|
||||||
});
|
});
|
||||||
init(eventType, params.bubbles || false,
|
init(
|
||||||
params.cancelable, window,
|
eventType,
|
||||||
params.ctrlKey, params.altKey,
|
params.bubbles || false,
|
||||||
params.shiftKey, params.metaKey,
|
params.cancelable,
|
||||||
params.keyCode, params.charCode);
|
window,
|
||||||
|
params.ctrlKey,
|
||||||
|
params.altKey,
|
||||||
|
params.shiftKey,
|
||||||
|
params.metaKey,
|
||||||
|
params.keyCode,
|
||||||
|
params.charCode
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -179,7 +179,8 @@ const GUI = function(pars) {
|
|||||||
let saveToLocalStorage;
|
let saveToLocalStorage;
|
||||||
let titleRow;
|
let titleRow;
|
||||||
|
|
||||||
Object.defineProperties(this,
|
Object.defineProperties(
|
||||||
|
this,
|
||||||
/** @lends GUI.prototype */
|
/** @lends GUI.prototype */
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -332,7 +333,8 @@ const GUI = function(pars) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Are we a root level GUI?
|
// Are we a root level GUI?
|
||||||
if (common.isUndefined(params.parent)) {
|
if (common.isUndefined(params.parent)) {
|
||||||
@ -412,7 +414,6 @@ const GUI = function(pars) {
|
|||||||
dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE);
|
dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make it not elastic.
|
// Make it not elastic.
|
||||||
if (!this.parent) {
|
if (!this.parent) {
|
||||||
setWidth(_this, params.width);
|
setWidth(_this, params.width);
|
||||||
@ -698,7 +699,6 @@ common.extend(
|
|||||||
this.domElement.style.display = '';
|
this.domElement.style.display = '';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
onResize: function() {
|
onResize: function() {
|
||||||
// we debounce this function to prevent performance issues when rotating on tablet/mobile
|
// we debounce this function to prevent performance issues when rotating on tablet/mobile
|
||||||
const root = this.getRoot();
|
const root = this.getRoot();
|
||||||
@ -991,8 +991,11 @@ function augmentController(gui, li, controller) {
|
|||||||
|
|
||||||
// All sliders should be accompanied by a box.
|
// All sliders should be accompanied by a box.
|
||||||
if (controller instanceof NumberControllerSlider) {
|
if (controller instanceof NumberControllerSlider) {
|
||||||
const box = new NumberControllerBox(controller.object, controller.property,
|
const box = new NumberControllerBox(
|
||||||
{ min: controller.__min, max: controller.__max, step: controller.__step });
|
controller.object,
|
||||||
|
controller.property,
|
||||||
|
{ min: controller.__min, max: controller.__max, step: controller.__step }
|
||||||
|
);
|
||||||
|
|
||||||
common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function(method) {
|
common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function(method) {
|
||||||
const pc = controller[method];
|
const pc = controller[method];
|
||||||
|
Loading…
Reference in New Issue
Block a user