mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Merge branch 'dionysiusmarquis-dionysius-brach' into develop
# Conflicts: # src/dat/controllers/NumberControllerBox.js # src/dat/controllers/NumberControllerSlider.js # src/dat/controllers/factory.js # src/dat/gui/style.css
This commit is contained in:
commit
e129e08b9d
@ -29,14 +29,20 @@ const ControllerFactory = function(object, property) {
|
|||||||
|
|
||||||
// Providing a map?
|
// Providing a map?
|
||||||
if (common.isNumber(initialValue)) {
|
if (common.isNumber(initialValue)) {
|
||||||
|
// Has min and max? (slider)
|
||||||
if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) {
|
if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) {
|
||||||
// Has min and max.
|
// has step?
|
||||||
if (common.isNumber(arguments[4])) { // 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]);
|
return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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] });
|
return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ class NumberControllerBox extends NumberController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDrag(e) {
|
function onMouseDrag(e) {
|
||||||
|
document.activeElement.blur();
|
||||||
|
|
||||||
const diff = prevY - e.clientY;
|
const diff = prevY - e.clientY;
|
||||||
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
||||||
|
|
||||||
@ -105,6 +107,7 @@ class NumberControllerBox extends NumberController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateDisplay() {
|
updateDisplay() {
|
||||||
|
if (dom.isActive(this.__input)) return null; // prevent number from update if user is trying to manually update
|
||||||
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
|
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
|
||||||
return super.updateDisplay();
|
return super.updateDisplay();
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ class NumberControllerSlider extends NumberController {
|
|||||||
dom.addClass(this.__foreground, 'slider-fg');
|
dom.addClass(this.__foreground, 'slider-fg');
|
||||||
|
|
||||||
function onMouseDown(e) {
|
function onMouseDown(e) {
|
||||||
|
document.activeElement.blur();
|
||||||
|
|
||||||
dom.bind(window, 'mousemove', onMouseDrag);
|
dom.bind(window, 'mousemove', onMouseDrag);
|
||||||
dom.bind(window, 'mouseup', onMouseUp);
|
dom.bind(window, 'mouseup', onMouseUp);
|
||||||
|
|
||||||
|
@ -187,6 +187,7 @@ $input-color: lighten($background-color, 8.5%);
|
|||||||
|
|
||||||
.slider-fg {
|
.slider-fg {
|
||||||
background: $number-color;
|
background: $number-color;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider:hover {
|
.slider:hover {
|
||||||
|
Loading…
Reference in New Issue
Block a user