mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_widget_numeri_step: Change click interval
Previous this commit, the task for auto-step can enter in a infinite loop. Now only creates a new task if no other task is running.
This commit is contained in:
committed by
Thanakrit Pintana
parent
ac0d3af968
commit
8e18dbde94
@@ -53,6 +53,7 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||
this._lazyOnChangeTrigger = _.debounce(function() {
|
||||
self.$input.trigger("change");
|
||||
}, this.DELAY_THROTTLE_CHANGE);
|
||||
this._auto_step_interval = false;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -164,13 +165,15 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||
},
|
||||
|
||||
_onStepMouseDown: function (ev) {
|
||||
this._interval = setTimeout(
|
||||
$.proxy(this, "_whileMouseDown", ev), this._click_delay);
|
||||
if (!this._auto_step_interval) {
|
||||
this._auto_step_interval = setTimeout(
|
||||
$.proxy(this, "_whileMouseDown", ev), this._click_delay);
|
||||
}
|
||||
},
|
||||
|
||||
_onMouseUp: function () {
|
||||
clearTimeout(this._interval);
|
||||
this._interval = false;
|
||||
clearTimeout(this._auto_step_interval);
|
||||
this._auto_step_interval = false;
|
||||
this._click_delay = this.DEF_CLICK_DELAY;
|
||||
},
|
||||
|
||||
@@ -182,6 +185,7 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||
this._click_delay -= this.SUBSTRACT_DELAY_STEP;
|
||||
}
|
||||
|
||||
this._auto_step_interval = false;
|
||||
this._onStepMouseDown(ev);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user