summaryrefslogtreecommitdiff
path: root/addons/pos_restaurant/static/src/js/Resizeable.js
diff options
context:
space:
mode:
authorJoseph Caburnay <jcb@odoo.com>2020-07-06 09:28:08 +0000
committerPierre Masereel <pim@odoo.com>2020-07-17 00:30:36 +0000
commitce8cb11054585ba27119656cb6a5e1760f27a84e (patch)
tree911d22c63703f3fe0845ac6065a827aecc2bc9fd /addons/pos_restaurant/static/src/js/Resizeable.js
parentf6f1ea6fd3886d7ebb89311039481ca676bc99a2 (diff)
[FIX] point_of_sale: touch events are passive and allow resize with touch events
1. Methods associated to touchmove and touchstart listeners should not call preventDefault because they are passive by default. Calling preventDefault will do nothing but in chrome browser, error message is issued. 2. We now allow resize based on touch events. closes odoo/odoo#54612 X-original-commit: c6b7133d9c9dc52a8d283124b5a4497940e54682 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/pos_restaurant/static/src/js/Resizeable.js')
-rw-r--r--addons/pos_restaurant/static/src/js/Resizeable.js36
1 files changed, 32 insertions, 4 deletions
diff --git a/addons/pos_restaurant/static/src/js/Resizeable.js b/addons/pos_restaurant/static/src/js/Resizeable.js
index a5bfe243c9a..c651ae09101 100644
--- a/addons/pos_restaurant/static/src/js/Resizeable.js
+++ b/addons/pos_restaurant/static/src/js/Resizeable.js
@@ -42,6 +42,38 @@ odoo.define('pos_restaurant.Resizeable', function(require) {
useExternalListener(document, 'mouseup', this.endResizeSE);
useListener('mousedown', '.resize-handle-se', this.startResizeSE);
+ useExternalListener(document, 'touchmove', this.resizeN);
+ useExternalListener(document, 'touchend', this.endResizeN);
+ useListener('touchstart', '.resize-handle-n', this.startResizeN);
+
+ useExternalListener(document, 'touchmove', this.resizeS);
+ useExternalListener(document, 'touchend', this.endResizeS);
+ useListener('touchstart', '.resize-handle-s', this.startResizeS);
+
+ useExternalListener(document, 'touchmove', this.resizeW);
+ useExternalListener(document, 'touchend', this.endResizeW);
+ useListener('touchstart', '.resize-handle-w', this.startResizeW);
+
+ useExternalListener(document, 'touchmove', this.resizeE);
+ useExternalListener(document, 'touchend', this.endResizeE);
+ useListener('touchstart', '.resize-handle-e', this.startResizeE);
+
+ useExternalListener(document, 'touchmove', this.resizeNW);
+ useExternalListener(document, 'touchend', this.endResizeNW);
+ useListener('touchstart', '.resize-handle-nw', this.startResizeNW);
+
+ useExternalListener(document, 'touchmove', this.resizeNE);
+ useExternalListener(document, 'touchend', this.endResizeNE);
+ useListener('touchstart', '.resize-handle-ne', this.startResizeNE);
+
+ useExternalListener(document, 'touchmove', this.resizeSW);
+ useExternalListener(document, 'touchend', this.endResizeSW);
+ useListener('touchstart', '.resize-handle-sw', this.startResizeSW);
+
+ useExternalListener(document, 'touchmove', this.resizeSE);
+ useExternalListener(document, 'touchend', this.endResizeSE);
+ useListener('touchstart', '.resize-handle-se', this.startResizeSE);
+
this.size = { height: 0, width: 0 };
this.loc = { top: 0, left: 0 };
this.tempSize = {};
@@ -93,7 +125,6 @@ odoo.define('pos_restaurant.Resizeable', function(require) {
this.el.style.height = `${this.size.height - dY}px`;
this.el.style.top = `${this.loc.top + dY}px`;
}
- event.preventDefault();
}
endResizeN() {
if (this.isResizingN && !this.isResizingE && !this.isResizingW && !this.isResizingS) {
@@ -126,7 +157,6 @@ odoo.define('pos_restaurant.Resizeable', function(require) {
}
this.el.style.height = `${this.size.height + dY}px`;
}
- event.preventDefault();
}
endResizeS() {
if (!this.isResizingN && !this.isResizingE && !this.isResizingW && this.isResizingS) {
@@ -160,7 +190,6 @@ odoo.define('pos_restaurant.Resizeable', function(require) {
this.el.style.width = `${this.size.width - dX}px`;
this.el.style.left = `${this.loc.left + dX}px`;
}
- event.preventDefault();
}
endResizeW() {
if (!this.isResizingN && !this.isResizingE && this.isResizingW && !this.isResizingS) {
@@ -200,7 +229,6 @@ odoo.define('pos_restaurant.Resizeable', function(require) {
}
this.el.style.width = `${this.size.width + dX}px`;
}
- event.preventDefault();
}
endResizeE() {
if (!this.isResizingN && this.isResizingE && !this.isResizingW && !this.isResizingS) {