@almadar/ui 5.110.0 → 5.111.0

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.
@@ -7816,6 +7816,13 @@ function bindCanvasCapture(captureFn) {
7816
7816
  window.__orbitalVerification.captureFrame = captureFn;
7817
7817
  }
7818
7818
  }
7819
+ function bindLastDrawables(getDrawables) {
7820
+ if (typeof window === "undefined") return;
7821
+ exposeOnWindow();
7822
+ if (window.__orbitalVerification) {
7823
+ window.__orbitalVerification.getLastDrawables = getDrawables;
7824
+ }
7825
+ }
7819
7826
  function updateAssetStatus(url, status) {
7820
7827
  if (typeof window === "undefined") return;
7821
7828
  exposeOnWindow();
@@ -9553,8 +9560,9 @@ var init_DrawSprite = __esm({
9553
9560
  if (!r) return;
9554
9561
  src = { x: r.sx, y: r.sy, w: r.sw, h: r.sh };
9555
9562
  }
9556
- const w = node.width ?? (src ? src.w : tex.width);
9557
- const h = node.height ?? (src ? src.h : tex.height);
9563
+ const tw = dctx.projector.tileWidth;
9564
+ const w = node.width !== void 0 ? node.width * tw : src ? src.w : tex.width;
9565
+ const h = node.height !== void 0 ? node.height * tw : src ? src.h : tex.height;
9558
9566
  const anchor = node.anchor ?? "top-left";
9559
9567
  const p = dctx.projector.anchorPoint(node.position, anchor);
9560
9568
  const dx = anchor === "top-left" ? p.x : p.x - w / 2;
@@ -9601,27 +9609,30 @@ var init_DrawShape = __esm({
9601
9609
  }
9602
9610
  case "rect": {
9603
9611
  const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "top-left");
9604
- const x = p.x + (node.offsetX ?? 0);
9605
- const y = p.y + (node.offsetY ?? 0);
9606
- const w = node.width ?? 0;
9607
- const h = node.height ?? 0;
9612
+ const tw = dctx.projector.tileWidth;
9613
+ const x = p.x + (node.offsetX ?? 0) * tw;
9614
+ const y = p.y + (node.offsetY ?? 0) * tw;
9615
+ const w = (node.width ?? 0) * tw;
9616
+ const h = (node.height ?? 0) * tw;
9608
9617
  if (node.fill) painter.fillRect(x, y, w, h, node.fill);
9609
9618
  if (node.stroke) painter.strokeRect(x, y, w, h, node.stroke, node.strokeWidth ?? 1);
9610
9619
  break;
9611
9620
  }
9612
9621
  case "ellipse": {
9613
9622
  const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "ground");
9614
- const cx = p.x + (node.offsetX ?? 0);
9615
- const cy = p.y + (node.offsetY ?? 0);
9616
- const rx = node.radiusX ?? 0;
9617
- const ry = node.radiusY ?? rx;
9623
+ const tw = dctx.projector.tileWidth;
9624
+ const cx = p.x + (node.offsetX ?? 0) * tw;
9625
+ const cy = p.y + (node.offsetY ?? 0) * tw;
9626
+ const rx = (node.radiusX ?? 0) * tw;
9627
+ const ry = (node.radiusY ?? rx) * tw;
9618
9628
  if (node.fill) painter.fillEllipse(cx, cy, rx, ry, node.fill);
9619
9629
  if (node.stroke) painter.strokeEllipse(cx, cy, rx, ry, node.stroke, node.strokeWidth ?? 1);
9620
9630
  break;
9621
9631
  }
9622
9632
  case "poly": {
9623
9633
  const base = dctx.projector.project(node.position);
9624
- const pts = (node.points ?? []).map((pt) => ({ x: base.x + pt.x, y: base.y + pt.y }));
9634
+ const tw = dctx.projector.tileWidth;
9635
+ const pts = (node.points ?? []).map((pt) => ({ x: base.x + pt.x * tw, y: base.y + pt.y * tw }));
9625
9636
  if (node.fill) painter.fillPoly(pts, node.fill);
9626
9637
  if (node.stroke) painter.strokePoly(pts, node.stroke, node.strokeWidth ?? 1, true);
9627
9638
  break;
@@ -9852,10 +9863,12 @@ function Canvas2D({
9852
9863
  const canvas = canvasRef.current;
9853
9864
  if (!canvas) return;
9854
9865
  bindCanvasCapture(() => canvas.toDataURL("image/png"));
9866
+ bindLastDrawables(() => drawables ?? null);
9855
9867
  return () => {
9856
9868
  bindCanvasCapture(() => null);
9869
+ bindLastDrawables(() => null);
9857
9870
  };
9858
- }, []);
9871
+ }, [drawables]);
9859
9872
  const enableCamera = camera === "pan-zoom";
9860
9873
  const {
9861
9874
  cameraRef,
@@ -9870,7 +9883,7 @@ function Canvas2D({
9870
9883
  screenToWorld,
9871
9884
  lerpToTarget
9872
9885
  } = useCamera();
9873
- const [, setAtlasVersion] = useState(0);
9886
+ const [atlasVersion, setAtlasVersion] = useState(0);
9874
9887
  const bumpAtlas = useCallback(() => setAtlasVersion((v) => v + 1), []);
9875
9888
  const miniMapTiles = useMemo(() => {
9876
9889
  if (!showMinimap) return [];
@@ -9938,6 +9951,9 @@ function Canvas2D({
9938
9951
  useEffect(() => {
9939
9952
  draw();
9940
9953
  }, [_imagePendingCount, draw]);
9954
+ useEffect(() => {
9955
+ draw();
9956
+ }, [atlasVersion, draw]);
9941
9957
  useEffect(() => {
9942
9958
  if (camera !== "follow" || !followTarget) return;
9943
9959
  let running = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.110.0",
3
+ "version": "5.111.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -117,12 +117,12 @@
117
117
  "access": "public"
118
118
  },
119
119
  "dependencies": {
120
- "@almadar/core": "^10.20.0",
120
+ "@almadar/core": "^10.25.0",
121
121
  "@almadar/evaluator": ">=2.9.2",
122
122
  "@almadar/logger": "^1.3.0",
123
- "@almadar/patterns": ">=2.97.0",
124
- "@almadar/runtime": "^6.21.0",
125
- "@almadar/std": ">=6.4.1",
123
+ "@almadar/patterns": "^2.101.0",
124
+ "@almadar/runtime": "^6.30.0",
125
+ "@almadar/std": "^16.134.0",
126
126
  "@almadar/syntax": ">=1.3.1",
127
127
  "@dnd-kit/core": "^6.3.1",
128
128
  "@dnd-kit/sortable": "^10.0.0",
@@ -205,10 +205,10 @@
205
205
  "three": "^0.160.1",
206
206
  "tsup": "^8.0.0",
207
207
  "tsx": "^4.7.0",
208
+ "turbo": "^2.8.17",
208
209
  "typescript": "^5.4.0",
209
210
  "vite": "^5.2.0",
210
- "vitest": "^3.2.6",
211
- "turbo": "^2.8.17"
211
+ "vitest": "^3.2.6"
212
212
  },
213
213
  "repository": {
214
214
  "type": "git",