@project-skymap/library 0.7.1 → 0.7.2

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/dist/index.js CHANGED
@@ -822,6 +822,12 @@ var createEngine_exports = {};
822
822
  __export(createEngine_exports, {
823
823
  createEngine: () => createEngine
824
824
  });
825
+ function triggerHaptic(style = "light") {
826
+ if (typeof navigator !== "undefined" && "vibrate" in navigator) {
827
+ const durations = { light: 10, medium: 25, heavy: 50 };
828
+ navigator.vibrate(durations[style]);
829
+ }
830
+ }
825
831
  function createEngine({
826
832
  container,
827
833
  onSelect,
@@ -2437,6 +2443,7 @@ function createEngine({
2437
2443
  clientY: state.touchStartY
2438
2444
  };
2439
2445
  const hit = pick(syntheticEvent);
2446
+ triggerHaptic("heavy");
2440
2447
  handlers.onLongPress?.(hit?.node ?? null, state.touchStartX, state.touchStartY);
2441
2448
  }
2442
2449
  }, ENGINE_CONFIG.longPressDelay);
@@ -2531,6 +2538,7 @@ function createEngine({
2531
2538
  const hit = pick(syntheticEvent);
2532
2539
  if (isDoubleTap) {
2533
2540
  if (hit) {
2541
+ triggerHaptic("medium");
2534
2542
  flyTo(hit.node.id, ENGINE_CONFIG.minFov);
2535
2543
  handlers.onSelect?.(hit.node);
2536
2544
  }
@@ -2539,6 +2547,7 @@ function createEngine({
2539
2547
  state.lastTapY = 0;
2540
2548
  } else {
2541
2549
  if (hit) {
2550
+ triggerHaptic("light");
2542
2551
  handlers.onSelect?.(hit.node);
2543
2552
  constellationLayer.setFocused(hit.node.id);
2544
2553
  if (hit.node.level === 2) setFocusedBook(hit.node.id);