@kuncat/avoidant 0.2.0 → 0.2.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.
@@ -10,8 +10,8 @@
10
10
  type MapShape,
11
11
  } from "../wasm/avoidant_wasm";
12
12
  import { Canvas, T } from "@threlte/core";
13
- import { OrbitControls } from "@threlte/extras";
14
- import { MOUSE, TOUCH, WebGLRenderer } from "three";
13
+ import MapControls from "./MapControls.svelte";
14
+ import { WebGLRenderer } from "three";
15
15
  import Board from "./board.svelte";
16
16
  import { m } from "../paraglide/messages";
17
17
  import { getLocale, locales, setLocale } from "../paraglide/runtime";
@@ -84,6 +84,11 @@
84
84
  let voidFractionInput = $state(0.15625);
85
85
  let spikinessInput = $state(0.8);
86
86
  let rngSeedInput = $state(0);
87
+ let randomSeed = $state(true);
88
+
89
+ function resetRandomSeed() {
90
+ rngSeedInput = crypto.getRandomValues(new Uint32Array(1))[0];
91
+ }
87
92
  // Shape selection state. The shape kind drives which numeric inputs are shown; each per-shape numeric value persists independently so switching back and forth doesn't reset the user's edits.
88
93
  let shapeKindInput = $state<ShapeKind>("icosahedron");
89
94
  let playerNameInput = $state<string>(m.default_player_name());
@@ -227,7 +232,7 @@
227
232
  }
228
233
 
229
234
  onMount(() => {
230
- rngSeedInput = Math.floor(Date.now() / 1000);
235
+ resetRandomSeed();
231
236
  relayServersInput = normalizeRelayServerList(relayServers).join("\n");
232
237
  try {
233
238
  playerNameInput = localStorage.getItem(PLAYER_NAME_STORAGE_KEY) ?? playerNameInput;
@@ -246,7 +251,9 @@
246
251
  voidFractionInput = saved.voidFraction;
247
252
  if (typeof saved.spikiness === "number" && saved.spikiness >= 0 && saved.spikiness <= 1)
248
253
  spikinessInput = saved.spikiness;
249
- if (Number.isSafeInteger(saved.rngSeed) && saved.rngSeed >= 0) rngSeedInput = saved.rngSeed;
254
+ randomSeed = saved.randomSeed !== false;
255
+ if (!randomSeed && Number.isSafeInteger(saved.rngSeed) && saved.rngSeed >= 0)
256
+ rngSeedInput = saved.rngSeed;
250
257
  if (typeof saved.relayServers === "string") relayServersInput = saved.relayServers;
251
258
  if (typeof saved.tutorialMode === "boolean") isTutorialMode = saved.tutorialMode;
252
259
  }
@@ -296,7 +303,8 @@
296
303
  numCells: numCellsInput,
297
304
  voidFraction: voidFractionInput,
298
305
  spikiness: spikinessInput,
299
- rngSeed: rngSeedInput,
306
+ randomSeed,
307
+ rngSeed: randomSeed ? undefined : rngSeedInput,
300
308
  relayServers: relayServersInput,
301
309
  tutorialMode: isTutorialMode,
302
310
  };
@@ -405,8 +413,11 @@
405
413
  ];
406
414
 
407
415
  async function startGame() {
416
+ if (status) return;
417
+ let nextGameState: GameState | undefined;
408
418
  try {
409
419
  const relayUrls = parseRelayServersInput($state.snapshot(relayServersInput));
420
+ if (randomSeed) resetRandomSeed();
410
421
  const options: GameOptions = {
411
422
  elevationMax: 6.0,
412
423
  elevationMin: 0.0,
@@ -418,10 +429,13 @@
418
429
  voidFraction: $state.snapshot(voidFractionInput),
419
430
  };
420
431
  status = m.status_generating_map();
421
- isFlatMap = options.shape?.kind === "flat";
422
- gameState = new GameState(options);
432
+ setupMode = undefined;
423
433
  const generated = await generateMap(options);
424
- gameState.applyMapCells(generated.cells);
434
+ nextGameState = new GameState(options);
435
+ nextGameState.applyMapCells(generated.cells);
436
+ // Publish only a complete map: mounting an empty game while old terrain
437
+ // remains makes the board look up terrain indices in an empty cell list.
438
+ isFlatMap = options.shape?.kind === "flat";
425
439
  terrain = generated.terrain;
426
440
  surfaceArea = generated.surfaceArea;
427
441
  boundsRadius = generated.boundsRadius;
@@ -429,7 +443,9 @@
429
443
  exploredCellsSeen = new SvelteSet<number>();
430
444
  pendingTutorialClick = undefined;
431
445
  tutorial = isTutorialMode ? new TutorialState() : undefined;
446
+ gameState = nextGameState;
432
447
  } catch (error) {
448
+ nextGameState?.free();
433
449
  console.error("Failed to start game", error);
434
450
  } finally {
435
451
  setupMode = undefined;
@@ -512,6 +528,9 @@
512
528
  console.error("Failed to release game state", error);
513
529
  }
514
530
  gameState = undefined;
531
+ terrain = undefined;
532
+ surfaceArea = 0;
533
+ boundsRadius = DEFAULT_RADIUS;
515
534
  setupMode = undefined;
516
535
  inviteTicket = "";
517
536
  ticketInput = "";
@@ -679,7 +698,7 @@
679
698
  <p class="mt-2 text-sm text-slate-600!">{status}</p>
680
699
  {/if}
681
700
 
682
- {#if !gameState}
701
+ {#if !gameState && !status}
683
702
  {#if setupMode === "host"}
684
703
  <form
685
704
  class="mt-4 w-full"
@@ -834,14 +853,33 @@
834
853
  <p class="field-help">{m.text_relay_servers_hint()}</p>
835
854
  <div class="mt-6 w-full">
836
855
  <label class="field-label" for="rng-seed-input">{m.field_seed()}</label>
837
- <input
838
- class="field"
839
- id="rng-seed-input"
840
- type="number"
841
- inputmode="numeric"
842
- bind:value={rngSeedInput}
843
- min="0"
844
- />
856
+ <div class="mb-3 flex">
857
+ <input
858
+ class="field mb-0! min-w-0 rounded-r-none! disabled:opacity-60"
859
+ id="rng-seed-input"
860
+ type="number"
861
+ inputmode="numeric"
862
+ bind:value={rngSeedInput}
863
+ disabled={randomSeed}
864
+ min="0"
865
+ max={Number.MAX_SAFE_INTEGER}
866
+ step="1"
867
+ required
868
+ />
869
+ <button
870
+ type="button"
871
+ class="btn shrink-0 rounded-l-none! text-xl"
872
+ class:btn-primary={randomSeed}
873
+ class:btn-secondary={!randomSeed}
874
+ title={m.action_random()}
875
+ aria-label={m.action_random()}
876
+ aria-pressed={randomSeed}
877
+ onclick={() => {
878
+ randomSeed = !randomSeed;
879
+ if (randomSeed) resetRandomSeed();
880
+ }}><span aria-hidden="true">⚄</span></button
881
+ >
882
+ </div>
845
883
  </div>
846
884
  </div>
847
885
  {/if}
@@ -996,14 +1034,7 @@
996
1034
  if (tutorial) pendingTutorialClick = cellIndex;
997
1035
  }}
998
1036
  />
999
- <OrbitControls
1000
- enablePan={true}
1001
- enableZoom={true}
1002
- enableRotate={true}
1003
- mouseButtons={{ LEFT: MOUSE.PAN, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.ROTATE }}
1004
- target={[0, 0, 0]}
1005
- touches={{ ONE: TOUCH.PAN, TWO: TOUCH.DOLLY_ROTATE }}
1006
- />
1037
+ <MapControls flat={isFlatMap} radius={boundsRadius} />
1007
1038
  </Canvas>
1008
1039
  </div>
1009
1040
  {/if}
@@ -0,0 +1,158 @@
1
+ <script lang="ts">
2
+ import { useThrelte } from "@threlte/core";
3
+ import { PerspectiveCamera, Raycaster, Vector2 } from "three";
4
+ import { cameraPlanePoint, orbitMap, orbitRadiansPerPixel, panMap, zoomMap } from "./map-camera";
5
+
6
+ let { flat, radius }: { flat: boolean; radius: number } = $props();
7
+ const { camera, renderer, scene, invalidate } = useThrelte();
8
+
9
+ $effect(() => {
10
+ const selectedCamera = $camera;
11
+ if (!(selectedCamera instanceof PerspectiveCamera)) return;
12
+ const activeCamera: PerspectiveCamera = selectedCamera;
13
+ const isFlat = flat;
14
+ const mapRadius = Math.max(1, radius);
15
+ const element = renderer.domElement;
16
+ // Gesture bookkeeping is deliberately non-reactive.
17
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
18
+ const pointers = new Map<number, { x: number; y: number; button: number }>();
19
+ let gestureDistance = 0;
20
+ let suppressClick = false;
21
+ const oldTouchAction = element.style.touchAction;
22
+ element.style.touchAction = "none";
23
+ activeCamera.lookAt(0, 0, 0);
24
+ activeCamera.updateMatrixWorld();
25
+ invalidate();
26
+
27
+ function ndc(x: number, y: number) {
28
+ const rect = element.getBoundingClientRect();
29
+ return new Vector2(
30
+ ((x - rect.left) / rect.width) * 2 - 1,
31
+ 1 - ((y - rect.top) / rect.height) * 2,
32
+ );
33
+ }
34
+
35
+ function anchorAt(x: number, y: number) {
36
+ const cursor = ndc(x, y);
37
+ const raycaster = new Raycaster();
38
+ raycaster.setFromCamera(cursor, activeCamera);
39
+ // Pick the visible terrain surface when possible, otherwise the map's center plane.
40
+ const terrain = scene.getObjectByName("terrain");
41
+ const hit = terrain ? raycaster.intersectObject(terrain, false)[0] : undefined;
42
+ return hit?.point ?? cameraPlanePoint(activeCamera, cursor);
43
+ }
44
+
45
+ function zoom(x: number, y: number, amount: number) {
46
+ const anchor = anchorAt(x, y);
47
+ if (!anchor) return;
48
+ zoomMap(
49
+ activeCamera,
50
+ anchor,
51
+ Math.exp(amount),
52
+ mapRadius * (isFlat ? 0.03 : 1.05),
53
+ mapRadius * 20,
54
+ !isFlat,
55
+ );
56
+ invalidate();
57
+ }
58
+
59
+ function pan(fromX: number, fromY: number, toX: number, toY: number) {
60
+ const anchor = anchorAt(fromX, fromY);
61
+ if (!anchor) return;
62
+ panMap(activeCamera, ndc(fromX, fromY), ndc(toX, toY), anchor);
63
+ invalidate();
64
+ }
65
+
66
+ function rotate(dx: number, dy: number) {
67
+ const scale = orbitRadiansPerPixel(activeCamera, mapRadius, element.clientHeight, isFlat);
68
+ orbitMap(activeCamera, dx * scale, dy * scale);
69
+ invalidate();
70
+ }
71
+
72
+ function down(event: PointerEvent) {
73
+ if (event.button > 2) return;
74
+ if (pointers.size === 0) {
75
+ gestureDistance = 0;
76
+ suppressClick = false;
77
+ } else suppressClick = true;
78
+ pointers.set(event.pointerId, { x: event.clientX, y: event.clientY, button: event.button });
79
+ element.setPointerCapture(event.pointerId);
80
+ }
81
+
82
+ function move(event: PointerEvent) {
83
+ const previous = pointers.get(event.pointerId);
84
+ if (!previous) return;
85
+ gestureDistance += Math.hypot(event.clientX - previous.x, event.clientY - previous.y);
86
+ if (gestureDistance > 8) suppressClick = true;
87
+ const before = [...pointers.values()];
88
+ pointers.set(event.pointerId, {
89
+ x: event.clientX,
90
+ y: event.clientY,
91
+ button: previous.button,
92
+ });
93
+ const after = [...pointers.values()];
94
+ if (before.length === 2) {
95
+ const midpoint = (points: typeof before) =>
96
+ new Vector2((points[0].x + points[1].x) / 2, (points[0].y + points[1].y) / 2);
97
+ const distance = (points: typeof before) =>
98
+ Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y);
99
+ const oldMid = midpoint(before);
100
+ const newMid = midpoint(after);
101
+ const oldDistance = distance(before);
102
+ const newDistance = distance(after);
103
+ if (oldDistance > 0 && newDistance > 0)
104
+ zoom(oldMid.x, oldMid.y, Math.log(oldDistance / newDistance));
105
+ rotate(newMid.x - oldMid.x, newMid.y - oldMid.y);
106
+ } else if (before.length === 1) {
107
+ const dx = event.clientX - previous.x;
108
+ const dy = event.clientY - previous.y;
109
+ if (previous.button === 1) zoom(event.clientX, event.clientY, dy * 0.01);
110
+ else if (event.shiftKey) rotate(dx, dy);
111
+ else pan(previous.x, previous.y, event.clientX, event.clientY);
112
+ }
113
+ }
114
+
115
+ function up(event: PointerEvent) {
116
+ pointers.delete(event.pointerId);
117
+ if (element.hasPointerCapture(event.pointerId))
118
+ element.releasePointerCapture(event.pointerId);
119
+ }
120
+
121
+ function wheel(event: WheelEvent) {
122
+ event.preventDefault();
123
+ const pixels =
124
+ event.deltaY *
125
+ (event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? element.clientHeight : 1);
126
+ zoom(event.clientX, event.clientY, Math.max(-0.5, Math.min(0.5, pixels * 0.001)));
127
+ }
128
+
129
+ function click(event: MouseEvent) {
130
+ if (suppressClick) event.stopImmediatePropagation();
131
+ }
132
+
133
+ function contextMenu(event: MouseEvent) {
134
+ event.preventDefault();
135
+ }
136
+ element.addEventListener("click", click, true);
137
+ element.addEventListener("pointerdown", down);
138
+ element.addEventListener("pointermove", move);
139
+ element.addEventListener("pointerup", up);
140
+ element.addEventListener("pointercancel", up);
141
+ element.addEventListener("lostpointercapture", up);
142
+ element.addEventListener("wheel", wheel, { passive: false });
143
+ element.addEventListener("contextmenu", contextMenu);
144
+ return () => {
145
+ element.removeEventListener("click", click, true);
146
+ element.removeEventListener("pointerdown", down);
147
+ element.removeEventListener("pointermove", move);
148
+ element.removeEventListener("pointerup", up);
149
+ element.removeEventListener("pointercancel", up);
150
+ element.removeEventListener("lostpointercapture", up);
151
+ element.removeEventListener("wheel", wheel);
152
+ element.removeEventListener("contextmenu", contextMenu);
153
+ for (const id of pointers.keys())
154
+ if (element.hasPointerCapture(id)) element.releasePointerCapture(id);
155
+ element.style.touchAction = oldTouchAction;
156
+ };
157
+ });
158
+ </script>
@@ -0,0 +1,7 @@
1
+ type $$ComponentProps = {
2
+ flat: boolean;
3
+ radius: number;
4
+ };
5
+ declare const MapControls: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type MapControls = ReturnType<typeof MapControls>;
7
+ export default MapControls;
@@ -588,7 +588,7 @@
588
588
  </script>
589
589
 
590
590
  <T is={opaqueMesh} />
591
- <T is={terrainMesh} onclick={handleTerrainClick} />
591
+ <T is={terrainMesh} name="terrain" onclick={handleTerrainClick} />
592
592
 
593
593
  {#each $cellMetadata as entry, i (i)}
594
594
  {#if entry.isExplored && !entry.isVoid && entry.voidNeighborCount > 0}
@@ -0,0 +1,10 @@
1
+ import { PerspectiveCamera, Vector2, Vector3 } from "three";
2
+ /** Rotate the entire camera frame around the map, without Euler-angle pole limits. */
3
+ export declare function orbitMap(camera: PerspectiveCamera, dx: number, dy: number): void;
4
+ /** Dolly along the anchor ray; the anchor keeps the same screen position. */
5
+ export declare function zoomMap(camera: PerspectiveCamera, anchor: Vector3, factor: number, minDistance: number, maxDistance: number, centeredBounds?: boolean): void;
6
+ /** Match rotation to the projected surface size, slowing down as the camera approaches it. */
7
+ export declare function orbitRadiansPerPixel(camera: PerspectiveCamera, radius: number, viewportHeight: number, flat?: boolean): number;
8
+ /** Move the grabbed surface point with the pointer without changing the orbit center. */
9
+ export declare function panMap(camera: PerspectiveCamera, from: Vector2, to: Vector2, anchor: Vector3): void;
10
+ export declare function cameraPlanePoint(camera: PerspectiveCamera, ndc: Vector2, anchor?: Vector3): Vector3 | null;
@@ -0,0 +1,73 @@
1
+ import { PerspectiveCamera, Plane, Quaternion, Raycaster, Vector2, Vector3 } from "three";
2
+ const origin = new Vector3();
3
+ /** Rotate the entire camera frame around the map, without Euler-angle pole limits. */
4
+ export function orbitMap(camera, dx, dy) {
5
+ const axis = new Vector3(dy, dx, 0);
6
+ const angle = axis.length();
7
+ if (!angle)
8
+ return;
9
+ axis.normalize().applyQuaternion(camera.quaternion);
10
+ const rotation = new Quaternion().setFromAxisAngle(axis, -angle);
11
+ camera.position.applyQuaternion(rotation);
12
+ camera.quaternion.premultiply(rotation).normalize();
13
+ camera.up.set(0, 1, 0).applyQuaternion(camera.quaternion);
14
+ camera.updateMatrixWorld();
15
+ }
16
+ /** Dolly along the anchor ray; the anchor keeps the same screen position. */
17
+ export function zoomMap(camera, anchor, factor, minDistance, maxDistance, centeredBounds = true) {
18
+ if (!centeredBounds) {
19
+ // Flat maps can be panned far from the origin; bound zoom relative to the focus.
20
+ const distance = camera.position.distanceTo(anchor);
21
+ if (!distance)
22
+ return;
23
+ factor = Math.max(minDistance / distance, Math.min(maxDistance / distance, factor));
24
+ camera.position.sub(anchor).multiplyScalar(factor).add(anchor);
25
+ camera.updateMatrixWorld();
26
+ return;
27
+ }
28
+ const next = camera.position.clone().sub(anchor).multiplyScalar(factor).add(anchor);
29
+ // Bound travel along the ray rather than clamping position off the cursor ray.
30
+ const delta = next.clone().sub(camera.position);
31
+ const distance = camera.position.length();
32
+ const limit = factor < 1 ? minDistance : maxDistance;
33
+ if ((factor < 1 && next.length() < limit) || (factor > 1 && next.length() > limit)) {
34
+ const a = delta.lengthSq();
35
+ const b = 2 * camera.position.dot(delta);
36
+ const c = distance * distance - limit * limit;
37
+ const discriminant = b * b - 4 * a * c;
38
+ if (!a || discriminant < 0)
39
+ return;
40
+ const roots = [
41
+ (-b - Math.sqrt(discriminant)) / (2 * a),
42
+ (-b + Math.sqrt(discriminant)) / (2 * a),
43
+ ];
44
+ const t = roots.filter((value) => value >= 0 && value <= 1).sort((a, b) => a - b)[0];
45
+ if (t === undefined)
46
+ return;
47
+ next.copy(camera.position).addScaledVector(delta, t);
48
+ }
49
+ camera.position.copy(next);
50
+ camera.updateMatrixWorld();
51
+ }
52
+ /** Match rotation to the projected surface size, slowing down as the camera approaches it. */
53
+ export function orbitRadiansPerPixel(camera, radius, viewportHeight, flat = false) {
54
+ const mapRadius = Math.max(1, radius);
55
+ const surfaceDistance = Math.max(mapRadius * 0.01, camera.position.length() - (flat ? 0 : mapRadius));
56
+ const visibleHeight = 2 * Math.tan((camera.getEffectiveFOV() * Math.PI) / 360) * surfaceDistance;
57
+ // The vertical FOV includes the aspect-ratio adjustment on narrow screens.
58
+ return 2 * Math.min(Math.PI * 2, visibleHeight / mapRadius) / Math.max(1, viewportHeight);
59
+ }
60
+ /** Move the grabbed surface point with the pointer without changing the orbit center. */
61
+ export function panMap(camera, from, to, anchor) {
62
+ const start = cameraPlanePoint(camera, from, anchor);
63
+ const end = cameraPlanePoint(camera, to, anchor);
64
+ if (start && end)
65
+ camera.position.add(start.sub(end));
66
+ camera.updateMatrixWorld();
67
+ }
68
+ export function cameraPlanePoint(camera, ndc, anchor = origin) {
69
+ const raycaster = new Raycaster();
70
+ raycaster.setFromCamera(ndc, camera);
71
+ const plane = new Plane().setFromNormalAndCoplanarPoint(camera.getWorldDirection(new Vector3()), anchor);
72
+ return raycaster.ray.intersectPlane(plane, new Vector3());
73
+ }
@@ -23,6 +23,7 @@ export * from "./field_radius_x.js";
23
23
  export * from "./field_radius_y.js";
24
24
  export * from "./field_radius_z.js";
25
25
  export * from "./field_relay_servers.js";
26
+ export * from "./action_random.js";
26
27
  export * from "./field_seed.js";
27
28
  export * from "./field_size.js";
28
29
  export * from "./field_spikiness.js";
@@ -25,6 +25,7 @@ export * from './field_radius_x.js'
25
25
  export * from './field_radius_y.js'
26
26
  export * from './field_radius_z.js'
27
27
  export * from './field_relay_servers.js'
28
+ export * from './action_random.js'
28
29
  export * from './field_seed.js'
29
30
  export * from './field_size.js'
30
31
  export * from './field_spikiness.js'
@@ -0,0 +1,16 @@
1
+ /**
2
+ * | output |
3
+ * | --- |
4
+ * | "Random" |
5
+ *
6
+ * @param {Action_RandomInputs} inputs
7
+ * @param {{ locale?: "en" | "bn" }} options
8
+ * @returns {LocalizedString}
9
+ */
10
+ export const action_random: ((inputs?: Action_RandomInputs, options?: {
11
+ locale?: "en" | "bn";
12
+ }) => LocalizedString) & import("../runtime.js").MessageMetadata<Action_RandomInputs, {
13
+ locale?: "en" | "bn";
14
+ }, {}>;
15
+ export type LocalizedString = import("../runtime.js").LocalizedString;
16
+ export type Action_RandomInputs = {};
@@ -0,0 +1,29 @@
1
+ /* eslint-disable */
2
+ import { getLocale, experimentalStaticLocale } from '../runtime.js';
3
+
4
+ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
5
+
6
+ /** @typedef {{}} Action_RandomInputs */
7
+
8
+ const en_action_random = /** @type {(inputs: Action_RandomInputs) => LocalizedString} */ () => {
9
+ return /** @type {LocalizedString} */ (`Random`)
10
+ };
11
+
12
+ const bn_action_random = /** @type {(inputs: Action_RandomInputs) => LocalizedString} */ () => {
13
+ return /** @type {LocalizedString} */ (`এলোমেলো`)
14
+ };
15
+
16
+ /**
17
+ * | output |
18
+ * | --- |
19
+ * | "Random" |
20
+ *
21
+ * @param {Action_RandomInputs} inputs
22
+ * @param {{ locale?: "en" | "bn" }} options
23
+ * @returns {LocalizedString}
24
+ */
25
+ export const action_random = /** @type {((inputs?: Action_RandomInputs, options?: { locale?: "en" | "bn" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Action_RandomInputs, { locale?: "en" | "bn" }, {}>} */ ((inputs = {}, options = {}) => {
26
+ const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
27
+ if (locale === "en") return en_action_random(inputs)
28
+ return bn_action_random(inputs)
29
+ });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * | output |
3
3
  * | --- |
4
- * | "Welcome to Avoidant. Take a moment to get familiar with moving the camera around: on a touchscreen, one-finger dragging will pan the map, and two fingers wil..." |
4
+ * | "Welcome to Avoidant. On any map, drag with one finger or either mouse button to pan. Hold Shift while dragging, or drag with two fingers on a touchscreen, to..." |
5
5
  *
6
6
  * @param {Tutorial_IntroInputs} inputs
7
7
  * @param {{ locale?: "en" | "bn" }} options
@@ -6,17 +6,17 @@ import { getLocale, experimentalStaticLocale } from '../runtime.js';
6
6
  /** @typedef {{}} Tutorial_IntroInputs */
7
7
 
8
8
  const en_tutorial_intro = /** @type {(inputs: Tutorial_IntroInputs) => LocalizedString} */ () => {
9
- return /** @type {LocalizedString} */ (`Welcome to Avoidant. Take a moment to get familiar with moving the camera around: on a touchscreen, one-finger dragging will pan the map, and two fingers will let you rotate and zoom. With a mouse, drag with the left mouse button to pan, drag with the right mouse button to rotate, and scroll to zoom. With a trackpad, holding shift while dragging lets you rotate. When you're comfortable with the controls, press Next to start exploring cells.`)
9
+ return /** @type {LocalizedString} */ (`Welcome to Avoidant. On any map, drag with one finger or either mouse button to pan. Hold Shift while dragging, or drag with two fingers on a touchscreen, to rotate around the map's center. Scroll to zoom toward the cursor, or pinch to zoom around the midpoint between your fingers. Rotation slows down as you zoom in. When you're comfortable with the controls, press Next to start exploring cells.`)
10
10
  };
11
11
 
12
12
  const bn_tutorial_intro = /** @type {(inputs: Tutorial_IntroInputs) => LocalizedString} */ () => {
13
- return /** @type {LocalizedString} */ (`Avoidant-এ স্বাগতম। প্রথমে ক্যামেরা ঘোরানোর সাথে পরিচিত হয়ে নিন: টাচস্ক্রিনে এক আঙুল দিয়ে টেনে ম্যাপ সরানো যায়, আর দুই আঙুলে ঘোরানো ও জুম করা যায়। মাউসে বাম বোতাম টেনে ম্যাপ সরান, ডান বোতাম টেনে ঘোরান, এবং স্ক্রল করে জুম করুন। ট্র্যাকপ্যাডে Shift চেপে টানলে ঘোরানো যাবে। নিয়ন্ত্রণে সাবলীল হলে পরবর্তী চাপুন এবং সেল অনুসন্ধান শুরু করুন।`)
13
+ return /** @type {LocalizedString} */ (`Avoidant-এ স্বাগতম। সব ধরনের ম্যাপে এক আঙুল দিয়ে বা মাউসের বাম বা ডান বোতাম চেপে টানলে ম্যাপ সরানো যায়। Shift চেপে টানলে, অথবা টাচস্ক্রিনে দুই আঙুল দিয়ে টানলে, ম্যাপের কেন্দ্র ঘিরে ঘোরানো যায়। কার্সরের অবস্থানের দিকে জুম করতে স্ক্রল করুন। দুই আঙুল কাছাকাছি বা দূরে সরালে আঙুল দুটির মাঝের বিন্দুকে কেন্দ্র করে জুম হবে। জুম করে কাছে গেলে ঘোরানোর গতি কমে। নিয়ন্ত্রণে সাবলীল হলে পরবর্তী চাপুন এবং সেল অনুসন্ধান শুরু করুন।`)
14
14
  };
15
15
 
16
16
  /**
17
17
  * | output |
18
18
  * | --- |
19
- * | "Welcome to Avoidant. Take a moment to get familiar with moving the camera around: on a touchscreen, one-finger dragging will pan the map, and two fingers wil..." |
19
+ * | "Welcome to Avoidant. On any map, drag with one finger or either mouse button to pan. Hold Shift while dragging, or drag with two fingers on a touchscreen, to..." |
20
20
  *
21
21
  * @param {Tutorial_IntroInputs} inputs
22
22
  * @param {{ locale?: "en" | "bn" }} options
@@ -52,7 +52,8 @@ h1 {
52
52
  }
53
53
 
54
54
  .panel-card {
55
- @apply rounded bg-slate-300 px-6 text-center shadow-xl;
55
+ @apply overflow-y-auto overscroll-y-contain rounded bg-slate-300 px-6 text-center shadow-xl;
56
+ max-height: calc(100dvh - 2rem);
56
57
  }
57
58
 
58
59
  .panel-header {
@@ -1331,12 +1331,12 @@ function __wbg_get_imports() {
1331
1331
  return ret;
1332
1332
  },
1333
1333
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1334
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3994, ret: Externref, inner_ret: Some(Externref) }, mutable: true }) -> Externref`.
1334
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3995, ret: Externref, inner_ret: Some(Externref) }, mutable: true }) -> Externref`.
1335
1335
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6ded4d2ca8032970___convert__closures_____invoke___wasm_bindgen_6ded4d2ca8032970___JsValue__wasm_bindgen_6ded4d2ca8032970___JsValue__true_);
1336
1336
  return ret;
1337
1337
  },
1338
1338
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1339
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3999, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1339
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 4000, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1340
1340
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6ded4d2ca8032970___convert__closures_____invoke___wasm_bindgen_6ded4d2ca8032970___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_6ded4d2ca8032970___JsError___true_);
1341
1341
  return ret;
1342
1342
  },
@@ -1346,7 +1346,7 @@ function __wbg_get_imports() {
1346
1346
  return ret;
1347
1347
  },
1348
1348
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1349
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2743, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1349
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2741, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1350
1350
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6ded4d2ca8032970___convert__closures_____invoke___web_sys_1a344eaec6f2c168___features__gen_MessageEvent__MessageEvent______true_);
1351
1351
  return ret;
1352
1352
  },
@@ -1356,17 +1356,17 @@ function __wbg_get_imports() {
1356
1356
  return ret;
1357
1357
  },
1358
1358
  __wbindgen_generic_0000000000000007: function(arg0, arg1) {
1359
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2475, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1359
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1360
1360
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6ded4d2ca8032970___convert__closures_____invoke_______true__1_);
1361
1361
  return ret;
1362
1362
  },
1363
1363
  __wbindgen_generic_0000000000000008: function(arg0, arg1) {
1364
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2477, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1364
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2476, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1365
1365
  const ret = makeClosure(arg0, arg1, wasm_bindgen_6ded4d2ca8032970___convert__closures_____invoke_______true__2_);
1366
1366
  return ret;
1367
1367
  },
1368
1368
  __wbindgen_generic_0000000000000009: function(arg0, arg1) {
1369
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3863, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1369
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3865, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1370
1370
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6ded4d2ca8032970___convert__closures_____invoke_______true__3_);
1371
1371
  return ret;
1372
1372
  },
Binary file
package/package.json CHANGED
@@ -84,5 +84,5 @@
84
84
  "**/*.css"
85
85
  ],
86
86
  "type": "module",
87
- "version": "0.2.0"
87
+ "version": "0.2.2"
88
88
  }