Skip to content

Commit 663e55f

Browse files
committed
fix touch events on iOS 13
1 parent 4e20f48 commit 663e55f

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "radial-menu",
3-
"version": "1.4.7",
3+
"version": "1.4.8",
44
"description": "Lovelace radial-menu",
55
"keywords": [
66
"home-assistant",

src/action-handler-directive.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@ class ActionHandler extends HTMLElement implements ActionHandler {
9090
y = (ev as MouseEvent).pageY;
9191
}
9292

93-
if (options.hasHold) {
94-
this.timer = window.setTimeout(() => {
95-
this.startAnimation(x, y);
96-
this.held = true;
97-
}, this.holdTime);
98-
}
93+
this.timer = window.setTimeout(() => {
94+
this.startAnimation(x, y);
95+
this.held = true;
96+
}, this.holdTime);
9997

10098
this.cooldownStart = true;
10199
window.setTimeout(() => (this.cooldownStart = false), 100);
@@ -141,7 +139,7 @@ class ActionHandler extends HTMLElement implements ActionHandler {
141139
// That might be a bug, but until it's fixed, this should make action-handler work.
142140
// If it's not a bug that is fixed, this might need updating with the next iOS version.
143141
// Note that all events (both touch and mouse) must be listened for in order to work on computers with both mouse and touchscreen.
144-
const isIOS13 = window.navigator.userAgent.match(/iPhone OS 13_/);
142+
const isIOS13 = /iPhone OS 13_/.test(window.navigator.userAgent);
145143
if (!isIOS13) {
146144
element.addEventListener('mousedown', clickStart, { passive: true });
147145
element.addEventListener('click', clickEnd);
@@ -168,7 +166,7 @@ class ActionHandler extends HTMLElement implements ActionHandler {
168166

169167
customElements.define('action-handler-radial', ActionHandler);
170168

171-
const geActionHandler = (): ActionHandler => {
169+
const getActionHandler = (): ActionHandler => {
172170
const body = document.body;
173171
if (body.querySelector('action-handler-radial')) {
174172
return body.querySelector('action-handler-radial') as ActionHandler;
@@ -181,7 +179,7 @@ const geActionHandler = (): ActionHandler => {
181179
};
182180

183181
export const actionHandlerBind = (element: ActionHandlerElement, options: ActionHandlerOptions): void => {
184-
const actionhandler: ActionHandler = geActionHandler();
182+
const actionhandler: ActionHandler = getActionHandler();
185183
if (!actionhandler) {
186184
return;
187185
}

src/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const CARD_VERSION = '1.4.7';
1+
export const CARD_VERSION = '1.4.8';

0 commit comments

Comments
 (0)