Skip to content

Commit

Permalink
enable resizing on touch devices
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Sep 10, 2024
1 parent f65f4eb commit b3a98a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/dashboard/src/widget-resize-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class WidgetResizeController extends EventTarget {
super();
this.host = host;
this.__resizedElementRemoveObserver = new MutationObserver(() => this.__restoreResizedElement());

this.__touchMoveCancelListener = (e) => e.preventDefault();
addListener(host, 'track', (e) => this.__onTrack(e));
}

Expand Down Expand Up @@ -50,6 +50,8 @@ export class WidgetResizeController extends EventTarget {

this.__resizedElement = e.target;
this.__resizedElementRemoveObserver.observe(this.host, { childList: true, subtree: true });

document.addEventListener('touchmove', this.__touchMoveCancelListener, { passive: false });
}

/** @private */
Expand Down Expand Up @@ -108,6 +110,7 @@ export class WidgetResizeController extends EventTarget {
this.host.$.grid.toggleAttribute('resizing', false);

this.__resizedElementRemoveObserver.disconnect();
document.removeEventListener('touchmove', this.__touchMoveCancelListener);

this.host.dispatchEvent(new CustomEvent('dashboard-item-resize-end'));
}
Expand Down

0 comments on commit b3a98a2

Please sign in to comment.