mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Number Controllers Improvements
adds the ability to change the value in the Number box while the controller is listening via .listen(). Prevents the slider bar from being wider than than 100%.
This commit is contained in:
parent
303cb10e07
commit
b94ff75f35
@ -85,7 +85,9 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDrag(e) {
|
function onMouseDrag(e) {
|
||||||
|
|
||||||
|
document.activeElement.blur();
|
||||||
|
|
||||||
var diff = prev_y - e.clientY;
|
var diff = prev_y - e.clientY;
|
||||||
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
_this.setValue(_this.getValue() + diff * _this.__impliedStep);
|
||||||
|
|
||||||
@ -114,7 +116,7 @@ define([
|
|||||||
{
|
{
|
||||||
|
|
||||||
updateDisplay: function() {
|
updateDisplay: function() {
|
||||||
|
if (dom.isActive(this.__input)) return;
|
||||||
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 NumberControllerBox.superclass.prototype.updateDisplay.call(this);
|
return NumberControllerBox.superclass.prototype.updateDisplay.call(this);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,9 @@ function(NumberController, dom, css, common, styleSheet) {
|
|||||||
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);
|
||||||
|
|
||||||
|
@ -273,7 +273,8 @@
|
|||||||
background: #303030;
|
background: #303030;
|
||||||
cursor: ew-resize; }
|
cursor: ew-resize; }
|
||||||
.dg .c .slider-fg {
|
.dg .c .slider-fg {
|
||||||
background: #2fa1d6; }
|
background: #2fa1d6;
|
||||||
|
max-width: 100%; }
|
||||||
.dg .c .slider:hover {
|
.dg .c .slider:hover {
|
||||||
background: #3c3c3c; }
|
background: #3c3c3c; }
|
||||||
.dg .c .slider:hover .slider-fg {
|
.dg .c .slider:hover .slider-fg {
|
||||||
|
Loading…
Reference in New Issue
Block a user