summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/libs
diff options
context:
space:
mode:
authorjbm-odoo <jbm@odoo.com>2020-02-06 12:24:14 +0000
committerYannick Tivisse <yti@odoo.com>2020-02-12 15:54:06 +0000
commit9a4da8894fdb7b51e01fa05a3911ccf57b143563 (patch)
tree2c50f42c69b66249a2e73b1653204c4af90c8624 /addons/web/static/src/js/libs
parentfdcab45992e7215b20af879f1a01135905ab2eaa (diff)
[FIX] web: Avoid open too fast zoom
Picture of employees are maximazed directly which is annoying when you move the mouse in kanban view. Add the ability to put a waiting time before opening the zoom in option of the field in the view (default value is 0). closes odoo/odoo#45229 Taskid: 2191289 X-original-commit: a264b17d8fe18464df439d896ecb7dea106caa5a Signed-off-by: jbm-odoo <jbm-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/libs')
-rw-r--r--addons/web/static/src/js/libs/zoomodoo.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/addons/web/static/src/js/libs/zoomodoo.js b/addons/web/static/src/js/libs/zoomodoo.js
index cbe0511102a..b4a97c9a8ad 100644
--- a/addons/web/static/src/js/libs/zoomodoo.js
+++ b/addons/web/static/src/js/libs/zoomodoo.js
@@ -29,6 +29,9 @@ var defaults = {
// event to trigger zoom
event: 'click', //or mouseenter
+ // Timer before trigger zoom
+ timer: 0,
+
// Prevent clicks on the zoom image link.
preventClicks: true,
@@ -197,13 +200,17 @@ ZoomOdoo.prototype.show = function (e, testMouseOver) {
* @param {Event} e
*/
ZoomOdoo.prototype._onEnter = function (e) {
+ var self = this;
var touches = e.originalEvent.touches;
-
+ e.preventDefault();
this.isMouseOver = true;
- if (!touches || touches.length === 1) {
- e.preventDefault();
- this.show(e, true);
- }
+
+ setTimeout(function () {
+ if (self.isMouseOver && (!touches || touches.length === 1)) {
+ self.show(e, true);
+ }
+ }, this.opts.timer);
+
};
/**