@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.
Files changed (2) hide show
  1. package/fig.js +14 -5
  2. 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
- this.addEventListener("pointerenter", this.showDelayedPopup.bind(this));
299
- this.addEventListener(
300
- "pointerleave",
301
- this.#handlePointerLeave.bind(this)
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {