mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Cosmetics
This commit is contained in:
parent
be567fd18e
commit
4a91f8e484
@ -33,6 +33,12 @@ In the terminal, enter the following:
|
|||||||
$ npm run build
|
$ npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## npm scripts
|
||||||
|
|
||||||
|
- npm test - Run ESLint
|
||||||
|
- npm run build - Build development and production version of scripts.
|
||||||
|
- npm run dev - Build development version of script watch for changes.
|
||||||
|
|
||||||
This will create a namespaced, unminified build of dat.GUI at `build/dat.gui.js`
|
This will create a namespaced, unminified build of dat.GUI at `build/dat.gui.js`
|
||||||
|
|
||||||
## Thanks
|
## Thanks
|
||||||
|
5212
build/dat.gui.js
5212
build/dat.gui.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
4
build/dat.gui.min.js
vendored
4
build/dat.gui.min.js
vendored
File diff suppressed because one or more lines are too long
17
index.js
17
index.js
@ -1 +1,16 @@
|
|||||||
module.exports = require('./src/dat/index');
|
/**
|
||||||
|
* dat-gui JavaScript Controller Library
|
||||||
|
* http://code.google.com/p/dat-gui
|
||||||
|
*
|
||||||
|
* Copyright 2011 Data Arts Team, Google Creative Lab
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
require('babel/polyfill');
|
||||||
|
|
||||||
|
export default require('./src/dat/index');
|
||||||
|
@ -38,5 +38,8 @@
|
|||||||
"sass-loader": "^2.0.0",
|
"sass-loader": "^2.0.0",
|
||||||
"style-loader": "^0.12.3",
|
"style-loader": "^0.12.3",
|
||||||
"webpack": "^1.11.0"
|
"webpack": "^1.11.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"babel": "^5.8.21"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,53 @@ class Color {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function defineRGBComponent(target, component, componentHexIndex) {
|
||||||
|
Object.defineProperty(target, component, {
|
||||||
|
get: function() {
|
||||||
|
if (this.__state.space === 'RGB') {
|
||||||
|
return this.__state[component];
|
||||||
|
}
|
||||||
|
|
||||||
|
Color.recalculateRGB(this, component, componentHexIndex);
|
||||||
|
|
||||||
|
return this.__state[component];
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(v) {
|
||||||
|
if (this.__state.space !== 'RGB') {
|
||||||
|
Color.recalculateRGB(this, component, componentHexIndex);
|
||||||
|
this.__state.space = 'RGB';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.__state[component] = v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function defineHSVComponent(target, component) {
|
||||||
|
Object.defineProperty(target, component, {
|
||||||
|
get: function() {
|
||||||
|
if (this.__state.space === 'HSV') {
|
||||||
|
return this.__state[component];
|
||||||
|
}
|
||||||
|
|
||||||
|
Color.recalculateHSV(this);
|
||||||
|
|
||||||
|
return this.__state[component];
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(v) {
|
||||||
|
if (this.__state.space !== 'HSV') {
|
||||||
|
Color.recalculateHSV(this);
|
||||||
|
this.__state.space = 'HSV';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.__state[component] = v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
@ -98,50 +145,4 @@ Object.defineProperty(Color.prototype, 'hex', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function defineRGBComponent(target, component, componentHexIndex) {
|
|
||||||
Object.defineProperty(target, component, {
|
|
||||||
get: function() {
|
|
||||||
if (this.__state.space === 'RGB') {
|
|
||||||
return this.__state[component];
|
|
||||||
}
|
|
||||||
|
|
||||||
Color.recalculateRGB(this, component, componentHexIndex);
|
|
||||||
|
|
||||||
return this.__state[component];
|
|
||||||
},
|
|
||||||
|
|
||||||
set: function(v) {
|
|
||||||
if (this.__state.space !== 'RGB') {
|
|
||||||
Color.recalculateRGB(this, component, componentHexIndex);
|
|
||||||
this.__state.space = 'RGB';
|
|
||||||
}
|
|
||||||
|
|
||||||
this.__state[component] = v;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function defineHSVComponent(target, component) {
|
|
||||||
Object.defineProperty(target, component, {
|
|
||||||
get: function() {
|
|
||||||
if (this.__state.space === 'HSV') {
|
|
||||||
return this.__state[component];
|
|
||||||
}
|
|
||||||
|
|
||||||
Color.recalculateHSV(this);
|
|
||||||
|
|
||||||
return this.__state[component];
|
|
||||||
},
|
|
||||||
|
|
||||||
set: function(v) {
|
|
||||||
if (this.__state.space !== 'HSV') {
|
|
||||||
Color.recalculateHSV(this);
|
|
||||||
this.__state.space = 'HSV';
|
|
||||||
}
|
|
||||||
|
|
||||||
this.__state[component] = v;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Color;
|
export default Color;
|
||||||
|
@ -50,6 +50,38 @@ class NumberControllerBox extends NumberController {
|
|||||||
*/
|
*/
|
||||||
let prevY;
|
let prevY;
|
||||||
|
|
||||||
|
function onChange() {
|
||||||
|
const attempted = parseFloat(_this.__input.value);
|
||||||
|
if (!common.isNaN(attempted)) {
|
||||||
|
_this.setValue(attempted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBlur() {
|
||||||
|
onChange();
|
||||||
|
if (_this.__onFinishChange) {
|
||||||
|
_this.__onFinishChange.call(_this, _this.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseDrag(e) {
|
||||||
|
const diff = prevY - e.clientY;
|
||||||
|
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
||||||
|
|
||||||
|
prevY = e.clientY;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseUp() {
|
||||||
|
dom.unbind(window, 'mousemove', onMouseDrag);
|
||||||
|
dom.unbind(window, 'mouseup', onMouseUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseDown(e) {
|
||||||
|
dom.bind(window, 'mousemove', onMouseDrag);
|
||||||
|
dom.bind(window, 'mouseup', onMouseUp);
|
||||||
|
prevY = e.clientY;
|
||||||
|
}
|
||||||
|
|
||||||
this.__input = document.createElement('input');
|
this.__input = document.createElement('input');
|
||||||
this.__input.setAttribute('type', 'text');
|
this.__input.setAttribute('type', 'text');
|
||||||
|
|
||||||
@ -67,38 +99,6 @@ class NumberControllerBox extends NumberController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function onChange() {
|
|
||||||
const attempted = parseFloat(_this.__input.value);
|
|
||||||
if (!common.isNaN(attempted)) {
|
|
||||||
_this.setValue(attempted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onBlur() {
|
|
||||||
onChange();
|
|
||||||
if (_this.__onFinishChange) {
|
|
||||||
_this.__onFinishChange.call(_this, _this.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMouseDown(e) {
|
|
||||||
dom.bind(window, 'mousemove', onMouseDrag);
|
|
||||||
dom.bind(window, 'mouseup', onMouseUp);
|
|
||||||
prevY = e.clientY;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMouseDrag(e) {
|
|
||||||
const diff = prevY - e.clientY;
|
|
||||||
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
|
||||||
|
|
||||||
prevY = e.clientY;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMouseUp() {
|
|
||||||
dom.unbind(window, 'mousemove', onMouseDrag);
|
|
||||||
dom.unbind(window, 'mouseup', onMouseUp);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
|
|
||||||
this.domElement.appendChild(this.__input);
|
this.domElement.appendChild(this.__input);
|
||||||
|
@ -47,7 +47,6 @@ class NumberControllerSlider extends NumberController {
|
|||||||
this.__background = document.createElement('div');
|
this.__background = document.createElement('div');
|
||||||
this.__foreground = document.createElement('div');
|
this.__foreground = document.createElement('div');
|
||||||
|
|
||||||
|
|
||||||
dom.bind(this.__background, 'mousedown', onMouseDown);
|
dom.bind(this.__background, 'mousedown', onMouseDown);
|
||||||
|
|
||||||
dom.addClass(this.__background, 'slider');
|
dom.addClass(this.__background, 'slider');
|
||||||
|
@ -30,6 +30,16 @@ class StringController extends Controller {
|
|||||||
|
|
||||||
const _this = this;
|
const _this = this;
|
||||||
|
|
||||||
|
function onChange() {
|
||||||
|
_this.setValue(_this.__input.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBlur() {
|
||||||
|
if (_this.__onFinishChange) {
|
||||||
|
_this.__onFinishChange.call(_this, _this.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.__input = document.createElement('input');
|
this.__input = document.createElement('input');
|
||||||
this.__input.setAttribute('type', 'text');
|
this.__input.setAttribute('type', 'text');
|
||||||
|
|
||||||
@ -42,17 +52,6 @@ class StringController extends Controller {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function onChange() {
|
|
||||||
_this.setValue(_this.__input.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onBlur() {
|
|
||||||
if (_this.__onFinishChange) {
|
|
||||||
_this.__onFinishChange.call(_this, _this.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
|
|
||||||
this.domElement.appendChild(this.__input);
|
this.domElement.appendChild(this.__input);
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import css from '../utils/css';
|
import css from '../utils/css';
|
||||||
import saveDialogueContents from 'html!./saveDialogue.html';
|
import saveDialogueContents from 'html!./saveDialogue.html';
|
||||||
import styleSheet from '!style!css!sass!./style.scss';
|
import styleSheet from '!style!css!sass!./style.scss';
|
||||||
|
@ -1,4 +1,17 @@
|
|||||||
module.exports = {
|
/**
|
||||||
|
* dat-gui JavaScript Controller Library
|
||||||
|
* http://code.google.com/p/dat-gui
|
||||||
|
*
|
||||||
|
* Copyright 2011 Data Arts Team, Google Creative Lab
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default {
|
||||||
color: {
|
color: {
|
||||||
Color: require('./color/Color'),
|
Color: require('./color/Color'),
|
||||||
math: require('./color/math'),
|
math: require('./color/math'),
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* dat-gui JavaScript Controller Library
|
||||||
|
* http://code.google.com/p/dat-gui
|
||||||
|
*
|
||||||
|
* Copyright 2011 Data Arts Team, Google Creative Lab
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
18
webpack/webpack.config.min.js
vendored
18
webpack/webpack.config.min.js
vendored
@ -1,10 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* dat-gui JavaScript Controller Library
|
||||||
|
* http://code.google.com/p/dat-gui
|
||||||
|
*
|
||||||
|
* Copyright 2011 Data Arts Team, Google Creative Lab
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
var extend = require('extend'),
|
var extend = require('extend'),
|
||||||
webpack = require('webpack'),
|
webpack = require('webpack'),
|
||||||
webpackConfig = require('./webpack.config');
|
webpackConfig = require('./webpack.config');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.optimize.UglifyJsPlugin({minimize: true})
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
|
minimize: true,
|
||||||
|
comments: false
|
||||||
|
})
|
||||||
],
|
],
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
|
Loading…
Reference in New Issue
Block a user