@rogieking/figui3 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fig.js +14 -5
- package/package.json +1 -1
package/fig.js
CHANGED
|
@@ -292,14 +292,23 @@ class FigTooltip extends HTMLElement {
|
|
|
292
292
|
}
|
|
293
293
|
document.body.addEventListener("click", this.hidePopupOutsideClick);
|
|
294
294
|
}
|
|
295
|
+
isTouchDevice() {
|
|
296
|
+
return (
|
|
297
|
+
"ontouchstart" in window ||
|
|
298
|
+
navigator.maxTouchPoints > 0 ||
|
|
299
|
+
navigator.msMaxTouchPoints > 0
|
|
300
|
+
);
|
|
301
|
+
}
|
|
295
302
|
|
|
296
303
|
setupEventListeners() {
|
|
297
304
|
if (this.action === "hover") {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
if (!this.isTouchDevice()) {
|
|
306
|
+
this.addEventListener("pointerenter", this.showDelayedPopup.bind(this));
|
|
307
|
+
this.addEventListener(
|
|
308
|
+
"pointerleave",
|
|
309
|
+
this.#handlePointerLeave.bind(this)
|
|
310
|
+
);
|
|
311
|
+
}
|
|
303
312
|
// Add mousedown listener instead of dragstart
|
|
304
313
|
this.addEventListener("mousedown", this.#boundHideOnDragStart);
|
|
305
314
|
|