mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
onFinish no longer fires during mouse drag of number control. fixes #112
This commit is contained in:
parent
a88a2461d8
commit
08a3e8f670
@ -57,14 +57,18 @@ class NumberControllerBox extends NumberController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBlur() {
|
function onFinish() {
|
||||||
onChange();
|
|
||||||
if (_this.__onFinishChange) {
|
if (_this.__onFinishChange) {
|
||||||
_this.__onFinishChange.call(_this, _this.getValue());
|
_this.__onFinishChange.call(_this, _this.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onBlur() {
|
||||||
|
onChange();
|
||||||
|
}
|
||||||
|
|
||||||
function onMouseDrag(e) {
|
function onMouseDrag(e) {
|
||||||
|
// TODO.. why do we need to blur to update input value?
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
const diff = prevY - e.clientY;
|
const diff = prevY - e.clientY;
|
||||||
@ -76,6 +80,7 @@ class NumberControllerBox extends NumberController {
|
|||||||
function onMouseUp() {
|
function onMouseUp() {
|
||||||
dom.unbind(window, 'mousemove', onMouseDrag);
|
dom.unbind(window, 'mousemove', onMouseDrag);
|
||||||
dom.unbind(window, 'mouseup', onMouseUp);
|
dom.unbind(window, 'mouseup', onMouseUp);
|
||||||
|
onFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDown(e) {
|
function onMouseDown(e) {
|
||||||
@ -93,11 +98,12 @@ class NumberControllerBox extends NumberController {
|
|||||||
dom.bind(this.__input, 'blur', onBlur);
|
dom.bind(this.__input, 'blur', onBlur);
|
||||||
dom.bind(this.__input, 'mousedown', onMouseDown);
|
dom.bind(this.__input, 'mousedown', onMouseDown);
|
||||||
dom.bind(this.__input, 'keydown', function(e) {
|
dom.bind(this.__input, 'keydown', function(e) {
|
||||||
// When pressing entire, you can be as precise as you want.
|
// When pressing enter, you can be as precise as you want.
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
_this.__truncationSuspended = true;
|
_this.__truncationSuspended = true;
|
||||||
this.blur();
|
this.blur();
|
||||||
_this.__truncationSuspended = false;
|
_this.__truncationSuspended = false;
|
||||||
|
onFinish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user