mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Changed tabs to two spaces. Happy?
This commit is contained in:
parent
561b4a1411
commit
92a13fd869
10
demo/demo.js
10
demo/demo.js
@ -10,7 +10,7 @@ function FizzyText(message) {
|
||||
this.maxSize = 3.2; // how big can they get?
|
||||
this.noiseStrength = 10; // how turbulent is the flow?
|
||||
this.speed = 0.4; // how fast do particles move?
|
||||
this.displayOutline = false; // should we draw the message as a stroke?
|
||||
this.displayOutline = true; // should we draw the message as a stroke?
|
||||
this.framesRendered = 0;
|
||||
|
||||
// __defineGetter__ and __defineSetter__ makes JavaScript believe that
|
||||
@ -30,11 +30,11 @@ function FizzyText(message) {
|
||||
// 0 arguments, we can call them from the dat-gui panel.
|
||||
|
||||
this.explode = function() {
|
||||
var mag = Math.random()*30+30;
|
||||
var mag = Math.random() * 30 + 30;
|
||||
for (var i in particles) {
|
||||
var angle= Math.random()*Math.PI*2;
|
||||
particles[i].vx = Math.cos(angle)*mag;
|
||||
particles[i].vy = Math.sin(angle)*mag;
|
||||
var angle = Math.random() * Math.PI * 2;
|
||||
particles[i].vx = Math.cos(angle) * mag;
|
||||
particles[i].vy = Math.sin(angle) * mag;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@ DAT.GUI.BooleanController = function() {
|
||||
var input = document.createElement('input');
|
||||
input.setAttribute('type', 'checkbox');
|
||||
|
||||
if(arguments[3]) {
|
||||
if (arguments[3]) {
|
||||
input.checked = true;
|
||||
this.setValue(true);
|
||||
} else {
|
||||
@ -38,7 +38,8 @@ DAT.GUI.BooleanController = function() {
|
||||
if (typeof val != "boolean") {
|
||||
try {
|
||||
val = eval(val);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
return DAT.GUI.Controller.prototype.setValue.call(this, val);
|
||||
};
|
||||
|
@ -54,7 +54,8 @@ DAT.GUI.Controller.prototype.getValue = function() {
|
||||
return this.object[this.propertyName];
|
||||
};
|
||||
|
||||
DAT.GUI.Controller.prototype.updateDisplay = function() {};
|
||||
DAT.GUI.Controller.prototype.updateDisplay = function() {
|
||||
};
|
||||
|
||||
DAT.GUI.Controller.prototype.onChange = function(fnc) {
|
||||
this.changeFunction = fnc;
|
||||
|
@ -25,5 +25,6 @@ DAT.GUI.FunctionController = function() {
|
||||
}
|
||||
_this.object[_this.propertyName].call(_this.object);
|
||||
};
|
||||
|
||||
};
|
||||
DAT.GUI.extendController(DAT.GUI.FunctionController);
|
||||
|
@ -20,7 +20,7 @@ DAT.GUI.NumberController = function() {
|
||||
|
||||
if (!step) {
|
||||
if (min != undefined && max != undefined) {
|
||||
step = (max-min)*0.01;
|
||||
step = (max - min) * 0.01;
|
||||
} else {
|
||||
step = 1;
|
||||
}
|
||||
@ -51,7 +51,7 @@ DAT.GUI.NumberController = function() {
|
||||
|
||||
numberField.addEventListener('mousewheel', function(e) {
|
||||
e.preventDefault();
|
||||
_this.setValue(_this.getValue() + Math.abs(e.wheelDeltaY)/e.wheelDeltaY*step);
|
||||
_this.setValue(_this.getValue() + Math.abs(e.wheelDeltaY) / e.wheelDeltaY * step);
|
||||
return false;
|
||||
}, false);
|
||||
|
||||
@ -65,7 +65,7 @@ DAT.GUI.NumberController = function() {
|
||||
// Handle up arrow and down arrow
|
||||
numberField.addEventListener('keydown', function(e) {
|
||||
var newVal;
|
||||
switch(e.keyCode) {
|
||||
switch (e.keyCode) {
|
||||
case 13: // enter
|
||||
newVal = parseFloat(this.value);
|
||||
_this.setValue(newVal);
|
||||
@ -89,7 +89,7 @@ DAT.GUI.NumberController = function() {
|
||||
numberField.focus();
|
||||
numberField.select();
|
||||
}
|
||||
if(slider) slider.domElement.className = slider.domElement.className.replace(' active', '');
|
||||
if (slider) slider.domElement.className = slider.domElement.className.replace(' active', '');
|
||||
draggedNumberField = false;
|
||||
clickedNumberField = false;
|
||||
if (_this.finishChangeFunction != null) {
|
||||
@ -110,12 +110,12 @@ DAT.GUI.NumberController = function() {
|
||||
DAT.GUI.makeUnselectable(_this.parent.domElement);
|
||||
DAT.GUI.makeUnselectable(numberField);
|
||||
|
||||
if(slider) slider.domElement.className += ' active';
|
||||
if (slider) slider.domElement.className += ' active';
|
||||
|
||||
py = y;
|
||||
y = e.pageY;
|
||||
var dy = py - y;
|
||||
var newVal = _this.getValue() + dy*step;
|
||||
var newVal = _this.getValue() + dy * step;
|
||||
_this.setValue(newVal);
|
||||
return false;
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ DAT.GUI.Slider = function(numberController, min, max, step, initValue) {
|
||||
var pos = findPos(_this.domElement);
|
||||
var val = DAT.GUI.map(e.pageX, pos[0], pos[0] + _this.domElement
|
||||
.offsetWidth, min, max);
|
||||
val = Math.round(val/step)*step;
|
||||
val = Math.round(val / step) * step;
|
||||
numberController.setValue(val);
|
||||
};
|
||||
|
||||
@ -56,7 +56,7 @@ DAT.GUI.Slider = function(numberController, min, max, step, initValue) {
|
||||
|
||||
this.__defineSetter__('value', function(e) {
|
||||
var pct = DAT.GUI.map(e, min, max, 0, 100);
|
||||
this.fg.style.width = pct+"%";
|
||||
this.fg.style.width = pct + "%";
|
||||
});
|
||||
|
||||
document.addEventListener('mousemove', onDrag, false);
|
||||
|
Loading…
Reference in New Issue
Block a user