@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.cjs CHANGED
@@ -844,6 +844,12 @@ var createEngine_exports = {};
844
844
  __export(createEngine_exports, {
845
845
  createEngine: () => createEngine
846
846
  });
847
+ function triggerHaptic(style = "light") {
848
+ if (typeof navigator !== "undefined" && "vibrate" in navigator) {
849
+ const durations = { light: 10, medium: 25, heavy: 50 };
850
+ navigator.vibrate(durations[style]);
851
+ }
852
+ }
847
853
  function createEngine({
848
854
  container,
849
855
  onSelect,
@@ -2459,6 +2465,7 @@ function createEngine({
2459
2465
  clientY: state.touchStartY
2460
2466
  };
2461
2467
  const hit = pick(syntheticEvent);
2468
+ triggerHaptic("heavy");
2462
2469
  handlers.onLongPress?.(hit?.node ?? null, state.touchStartX, state.touchStartY);
2463
2470
  }
2464
2471
  }, ENGINE_CONFIG.longPressDelay);
@@ -2553,6 +2560,7 @@ function createEngine({
2553
2560
  const hit = pick(syntheticEvent);
2554
2561
  if (isDoubleTap) {
2555
2562
  if (hit) {
2563
+ triggerHaptic("medium");
2556
2564
  flyTo(hit.node.id, ENGINE_CONFIG.minFov);
2557
2565
  handlers.onSelect?.(hit.node);
2558
2566
  }
@@ -2561,6 +2569,7 @@ function createEngine({
2561
2569
  state.lastTapY = 0;
2562
2570
  } else {
2563
2571
  if (hit) {
2572
+ triggerHaptic("light");
2564
2573
  handlers.onSelect?.(hit.node);
2565
2574
  constellationLayer.setFocused(hit.node.id);
2566
2575
  if (hit.node.level === 2) setFocusedBook(hit.node.id);