@almadar/ui 5.109.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.
- package/dist/avl/index.cjs +32 -13
- package/dist/avl/index.js +32 -13
- package/dist/components/game/atoms/DrawShape.d.ts +6 -6
- package/dist/components/game/atoms/DrawSprite.d.ts +2 -2
- package/dist/components/index.cjs +29 -13
- package/dist/components/index.js +29 -13
- package/dist/lib/drawable/three/index.cjs +330 -178
- package/dist/lib/drawable/three/index.js +174 -22
- package/dist/lib/index.cjs +8 -0
- package/dist/lib/index.js +8 -1
- package/dist/lib/verificationRegistry.d.ts +6 -0
- package/dist/providers/index.cjs +29 -13
- package/dist/providers/index.js +29 -13
- package/dist/runtime/index.cjs +32 -13
- package/dist/runtime/index.js +32 -13
- package/package.json +7 -7
package/dist/avl/index.cjs
CHANGED
|
@@ -11162,6 +11162,13 @@ function bindCanvasCapture(captureFn) {
|
|
|
11162
11162
|
window.__orbitalVerification.captureFrame = captureFn;
|
|
11163
11163
|
}
|
|
11164
11164
|
}
|
|
11165
|
+
function bindLastDrawables(getDrawables) {
|
|
11166
|
+
if (typeof window === "undefined") return;
|
|
11167
|
+
exposeOnWindow();
|
|
11168
|
+
if (window.__orbitalVerification) {
|
|
11169
|
+
window.__orbitalVerification.getLastDrawables = getDrawables;
|
|
11170
|
+
}
|
|
11171
|
+
}
|
|
11165
11172
|
function updateAssetStatus(url, status) {
|
|
11166
11173
|
if (typeof window === "undefined") return;
|
|
11167
11174
|
exposeOnWindow();
|
|
@@ -13006,8 +13013,9 @@ var init_DrawSprite = __esm({
|
|
|
13006
13013
|
if (!r2) return;
|
|
13007
13014
|
src = { x: r2.sx, y: r2.sy, w: r2.sw, h: r2.sh };
|
|
13008
13015
|
}
|
|
13009
|
-
const
|
|
13010
|
-
const
|
|
13016
|
+
const tw = dctx.projector.tileWidth;
|
|
13017
|
+
const w = node.width !== void 0 ? node.width * tw : src ? src.w : tex.width;
|
|
13018
|
+
const h = node.height !== void 0 ? node.height * tw : src ? src.h : tex.height;
|
|
13011
13019
|
const anchor = node.anchor ?? "top-left";
|
|
13012
13020
|
const p = dctx.projector.anchorPoint(node.position, anchor);
|
|
13013
13021
|
const dx = anchor === "top-left" ? p.x : p.x - w / 2;
|
|
@@ -13054,27 +13062,30 @@ var init_DrawShape = __esm({
|
|
|
13054
13062
|
}
|
|
13055
13063
|
case "rect": {
|
|
13056
13064
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "top-left");
|
|
13057
|
-
const
|
|
13058
|
-
const
|
|
13059
|
-
const
|
|
13060
|
-
const
|
|
13065
|
+
const tw = dctx.projector.tileWidth;
|
|
13066
|
+
const x = p.x + (node.offsetX ?? 0) * tw;
|
|
13067
|
+
const y = p.y + (node.offsetY ?? 0) * tw;
|
|
13068
|
+
const w = (node.width ?? 0) * tw;
|
|
13069
|
+
const h = (node.height ?? 0) * tw;
|
|
13061
13070
|
if (node.fill) painter.fillRect(x, y, w, h, node.fill);
|
|
13062
13071
|
if (node.stroke) painter.strokeRect(x, y, w, h, node.stroke, node.strokeWidth ?? 1);
|
|
13063
13072
|
break;
|
|
13064
13073
|
}
|
|
13065
13074
|
case "ellipse": {
|
|
13066
13075
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "ground");
|
|
13067
|
-
const
|
|
13068
|
-
const
|
|
13069
|
-
const
|
|
13070
|
-
const
|
|
13076
|
+
const tw = dctx.projector.tileWidth;
|
|
13077
|
+
const cx = p.x + (node.offsetX ?? 0) * tw;
|
|
13078
|
+
const cy = p.y + (node.offsetY ?? 0) * tw;
|
|
13079
|
+
const rx = (node.radiusX ?? 0) * tw;
|
|
13080
|
+
const ry = (node.radiusY ?? rx) * tw;
|
|
13071
13081
|
if (node.fill) painter.fillEllipse(cx, cy, rx, ry, node.fill);
|
|
13072
13082
|
if (node.stroke) painter.strokeEllipse(cx, cy, rx, ry, node.stroke, node.strokeWidth ?? 1);
|
|
13073
13083
|
break;
|
|
13074
13084
|
}
|
|
13075
13085
|
case "poly": {
|
|
13076
13086
|
const base = dctx.projector.project(node.position);
|
|
13077
|
-
const
|
|
13087
|
+
const tw = dctx.projector.tileWidth;
|
|
13088
|
+
const pts = (node.points ?? []).map((pt) => ({ x: base.x + pt.x * tw, y: base.y + pt.y * tw }));
|
|
13078
13089
|
if (node.fill) painter.fillPoly(pts, node.fill);
|
|
13079
13090
|
if (node.stroke) painter.strokePoly(pts, node.stroke, node.strokeWidth ?? 1, true);
|
|
13080
13091
|
break;
|
|
@@ -13305,10 +13316,12 @@ function Canvas2D({
|
|
|
13305
13316
|
const canvas = canvasRef.current;
|
|
13306
13317
|
if (!canvas) return;
|
|
13307
13318
|
bindCanvasCapture(() => canvas.toDataURL("image/png"));
|
|
13319
|
+
bindLastDrawables(() => drawables ?? null);
|
|
13308
13320
|
return () => {
|
|
13309
13321
|
bindCanvasCapture(() => null);
|
|
13322
|
+
bindLastDrawables(() => null);
|
|
13310
13323
|
};
|
|
13311
|
-
}, []);
|
|
13324
|
+
}, [drawables]);
|
|
13312
13325
|
const enableCamera = camera === "pan-zoom";
|
|
13313
13326
|
const {
|
|
13314
13327
|
cameraRef,
|
|
@@ -13323,7 +13336,7 @@ function Canvas2D({
|
|
|
13323
13336
|
screenToWorld,
|
|
13324
13337
|
lerpToTarget
|
|
13325
13338
|
} = useCamera();
|
|
13326
|
-
const [, setAtlasVersion] = React90.useState(0);
|
|
13339
|
+
const [atlasVersion, setAtlasVersion] = React90.useState(0);
|
|
13327
13340
|
const bumpAtlas = React90.useCallback(() => setAtlasVersion((v) => v + 1), []);
|
|
13328
13341
|
const miniMapTiles = React90.useMemo(() => {
|
|
13329
13342
|
if (!showMinimap) return [];
|
|
@@ -13391,6 +13404,9 @@ function Canvas2D({
|
|
|
13391
13404
|
React90.useEffect(() => {
|
|
13392
13405
|
draw();
|
|
13393
13406
|
}, [_imagePendingCount, draw]);
|
|
13407
|
+
React90.useEffect(() => {
|
|
13408
|
+
draw();
|
|
13409
|
+
}, [atlasVersion, draw]);
|
|
13394
13410
|
React90.useEffect(() => {
|
|
13395
13411
|
if (camera !== "follow" || !followTarget) return;
|
|
13396
13412
|
let running = true;
|
|
@@ -49882,6 +49898,9 @@ function collectEmbeddedTraits(schema) {
|
|
|
49882
49898
|
if (!traitRef || typeof traitRef !== "object") continue;
|
|
49883
49899
|
const resolved = traitRef._resolved;
|
|
49884
49900
|
const target = resolved && typeof resolved === "object" ? resolved : traitRef;
|
|
49901
|
+
if (target.config) {
|
|
49902
|
+
collectTraitRefsFromValue(target.config, out);
|
|
49903
|
+
}
|
|
49885
49904
|
const transitions = target.stateMachine?.transitions;
|
|
49886
49905
|
if (!Array.isArray(transitions)) continue;
|
|
49887
49906
|
for (const t of transitions) {
|
package/dist/avl/index.js
CHANGED
|
@@ -11116,6 +11116,13 @@ function bindCanvasCapture(captureFn) {
|
|
|
11116
11116
|
window.__orbitalVerification.captureFrame = captureFn;
|
|
11117
11117
|
}
|
|
11118
11118
|
}
|
|
11119
|
+
function bindLastDrawables(getDrawables) {
|
|
11120
|
+
if (typeof window === "undefined") return;
|
|
11121
|
+
exposeOnWindow();
|
|
11122
|
+
if (window.__orbitalVerification) {
|
|
11123
|
+
window.__orbitalVerification.getLastDrawables = getDrawables;
|
|
11124
|
+
}
|
|
11125
|
+
}
|
|
11119
11126
|
function updateAssetStatus(url, status) {
|
|
11120
11127
|
if (typeof window === "undefined") return;
|
|
11121
11128
|
exposeOnWindow();
|
|
@@ -12960,8 +12967,9 @@ var init_DrawSprite = __esm({
|
|
|
12960
12967
|
if (!r2) return;
|
|
12961
12968
|
src = { x: r2.sx, y: r2.sy, w: r2.sw, h: r2.sh };
|
|
12962
12969
|
}
|
|
12963
|
-
const
|
|
12964
|
-
const
|
|
12970
|
+
const tw = dctx.projector.tileWidth;
|
|
12971
|
+
const w = node.width !== void 0 ? node.width * tw : src ? src.w : tex.width;
|
|
12972
|
+
const h = node.height !== void 0 ? node.height * tw : src ? src.h : tex.height;
|
|
12965
12973
|
const anchor = node.anchor ?? "top-left";
|
|
12966
12974
|
const p = dctx.projector.anchorPoint(node.position, anchor);
|
|
12967
12975
|
const dx = anchor === "top-left" ? p.x : p.x - w / 2;
|
|
@@ -13008,27 +13016,30 @@ var init_DrawShape = __esm({
|
|
|
13008
13016
|
}
|
|
13009
13017
|
case "rect": {
|
|
13010
13018
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "top-left");
|
|
13011
|
-
const
|
|
13012
|
-
const
|
|
13013
|
-
const
|
|
13014
|
-
const
|
|
13019
|
+
const tw = dctx.projector.tileWidth;
|
|
13020
|
+
const x = p.x + (node.offsetX ?? 0) * tw;
|
|
13021
|
+
const y = p.y + (node.offsetY ?? 0) * tw;
|
|
13022
|
+
const w = (node.width ?? 0) * tw;
|
|
13023
|
+
const h = (node.height ?? 0) * tw;
|
|
13015
13024
|
if (node.fill) painter.fillRect(x, y, w, h, node.fill);
|
|
13016
13025
|
if (node.stroke) painter.strokeRect(x, y, w, h, node.stroke, node.strokeWidth ?? 1);
|
|
13017
13026
|
break;
|
|
13018
13027
|
}
|
|
13019
13028
|
case "ellipse": {
|
|
13020
13029
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "ground");
|
|
13021
|
-
const
|
|
13022
|
-
const
|
|
13023
|
-
const
|
|
13024
|
-
const
|
|
13030
|
+
const tw = dctx.projector.tileWidth;
|
|
13031
|
+
const cx = p.x + (node.offsetX ?? 0) * tw;
|
|
13032
|
+
const cy = p.y + (node.offsetY ?? 0) * tw;
|
|
13033
|
+
const rx = (node.radiusX ?? 0) * tw;
|
|
13034
|
+
const ry = (node.radiusY ?? rx) * tw;
|
|
13025
13035
|
if (node.fill) painter.fillEllipse(cx, cy, rx, ry, node.fill);
|
|
13026
13036
|
if (node.stroke) painter.strokeEllipse(cx, cy, rx, ry, node.stroke, node.strokeWidth ?? 1);
|
|
13027
13037
|
break;
|
|
13028
13038
|
}
|
|
13029
13039
|
case "poly": {
|
|
13030
13040
|
const base = dctx.projector.project(node.position);
|
|
13031
|
-
const
|
|
13041
|
+
const tw = dctx.projector.tileWidth;
|
|
13042
|
+
const pts = (node.points ?? []).map((pt) => ({ x: base.x + pt.x * tw, y: base.y + pt.y * tw }));
|
|
13032
13043
|
if (node.fill) painter.fillPoly(pts, node.fill);
|
|
13033
13044
|
if (node.stroke) painter.strokePoly(pts, node.stroke, node.strokeWidth ?? 1, true);
|
|
13034
13045
|
break;
|
|
@@ -13259,10 +13270,12 @@ function Canvas2D({
|
|
|
13259
13270
|
const canvas = canvasRef.current;
|
|
13260
13271
|
if (!canvas) return;
|
|
13261
13272
|
bindCanvasCapture(() => canvas.toDataURL("image/png"));
|
|
13273
|
+
bindLastDrawables(() => drawables ?? null);
|
|
13262
13274
|
return () => {
|
|
13263
13275
|
bindCanvasCapture(() => null);
|
|
13276
|
+
bindLastDrawables(() => null);
|
|
13264
13277
|
};
|
|
13265
|
-
}, []);
|
|
13278
|
+
}, [drawables]);
|
|
13266
13279
|
const enableCamera = camera === "pan-zoom";
|
|
13267
13280
|
const {
|
|
13268
13281
|
cameraRef,
|
|
@@ -13277,7 +13290,7 @@ function Canvas2D({
|
|
|
13277
13290
|
screenToWorld,
|
|
13278
13291
|
lerpToTarget
|
|
13279
13292
|
} = useCamera();
|
|
13280
|
-
const [, setAtlasVersion] = useState(0);
|
|
13293
|
+
const [atlasVersion, setAtlasVersion] = useState(0);
|
|
13281
13294
|
const bumpAtlas = useCallback(() => setAtlasVersion((v) => v + 1), []);
|
|
13282
13295
|
const miniMapTiles = useMemo(() => {
|
|
13283
13296
|
if (!showMinimap) return [];
|
|
@@ -13345,6 +13358,9 @@ function Canvas2D({
|
|
|
13345
13358
|
useEffect(() => {
|
|
13346
13359
|
draw();
|
|
13347
13360
|
}, [_imagePendingCount, draw]);
|
|
13361
|
+
useEffect(() => {
|
|
13362
|
+
draw();
|
|
13363
|
+
}, [atlasVersion, draw]);
|
|
13348
13364
|
useEffect(() => {
|
|
13349
13365
|
if (camera !== "follow" || !followTarget) return;
|
|
13350
13366
|
let running = true;
|
|
@@ -49836,6 +49852,9 @@ function collectEmbeddedTraits(schema) {
|
|
|
49836
49852
|
if (!traitRef || typeof traitRef !== "object") continue;
|
|
49837
49853
|
const resolved = traitRef._resolved;
|
|
49838
49854
|
const target = resolved && typeof resolved === "object" ? resolved : traitRef;
|
|
49855
|
+
if (target.config) {
|
|
49856
|
+
collectTraitRefsFromValue(target.config, out);
|
|
49857
|
+
}
|
|
49839
49858
|
const transitions = target.stateMachine?.transitions;
|
|
49840
49859
|
if (!Array.isArray(transitions)) continue;
|
|
49841
49860
|
for (const t of transitions) {
|
|
@@ -24,18 +24,18 @@ export interface DrawShapeProps extends DrawableBase {
|
|
|
24
24
|
position: ScenePos;
|
|
25
25
|
/** How the shape aligns to its projected position. Default varies by `shape`. */
|
|
26
26
|
anchor?: DrawableAnchor;
|
|
27
|
-
/** Rect width in
|
|
27
|
+
/** Rect width in world units (fractions of `projector.tileWidth`). */
|
|
28
28
|
width?: number;
|
|
29
|
-
/** Rect height in
|
|
29
|
+
/** Rect height in world units (fractions of `projector.tileWidth`). */
|
|
30
30
|
height?: number;
|
|
31
|
-
/** Ellipse horizontal radius in
|
|
31
|
+
/** Ellipse horizontal radius in world units (fractions of `projector.tileWidth`). */
|
|
32
32
|
radiusX?: number;
|
|
33
|
-
/** Ellipse vertical radius in
|
|
33
|
+
/** Ellipse vertical radius in world units; omitted → `radiusX` (a circle). */
|
|
34
34
|
radiusY?: number;
|
|
35
|
-
/** Fine
|
|
35
|
+
/** Fine nudge from the anchor point in world units. */
|
|
36
36
|
offsetX?: number;
|
|
37
37
|
offsetY?: number;
|
|
38
|
-
/** Poly vertices as
|
|
38
|
+
/** Poly vertices as world-unit offsets relative to the cell's projected top-left. */
|
|
39
39
|
points?: PainterPoint[];
|
|
40
40
|
fill?: string;
|
|
41
41
|
stroke?: string;
|
|
@@ -25,9 +25,9 @@ export interface DrawSpriteProps extends DrawableBase {
|
|
|
25
25
|
asset: Asset;
|
|
26
26
|
/** How the sprite aligns to its projected position. Default `'top-left'`. */
|
|
27
27
|
anchor?: DrawableAnchor;
|
|
28
|
-
/** Draw width in
|
|
28
|
+
/** Draw width in world units (fractions of `projector.tileWidth`); omitted → resolved source width in px. */
|
|
29
29
|
width?: number;
|
|
30
|
-
/** Draw height in
|
|
30
|
+
/** Draw height in world units (fractions of `projector.tileWidth`); omitted → resolved source height in px. */
|
|
31
31
|
height?: number;
|
|
32
32
|
/** Explicit atlas sub-rect override (px); omitted → resolved from `asset.atlas`/`asset.sprite`. */
|
|
33
33
|
frame?: BlitSrc;
|
|
@@ -15303,6 +15303,13 @@ function bindCanvasCapture(captureFn) {
|
|
|
15303
15303
|
window.__orbitalVerification.captureFrame = captureFn;
|
|
15304
15304
|
}
|
|
15305
15305
|
}
|
|
15306
|
+
function bindLastDrawables(getDrawables) {
|
|
15307
|
+
if (typeof window === "undefined") return;
|
|
15308
|
+
exposeOnWindow();
|
|
15309
|
+
if (window.__orbitalVerification) {
|
|
15310
|
+
window.__orbitalVerification.getLastDrawables = getDrawables;
|
|
15311
|
+
}
|
|
15312
|
+
}
|
|
15306
15313
|
function updateAssetStatus(url, status) {
|
|
15307
15314
|
if (typeof window === "undefined") return;
|
|
15308
15315
|
exposeOnWindow();
|
|
@@ -15865,8 +15872,9 @@ var init_DrawSprite = __esm({
|
|
|
15865
15872
|
if (!r) return;
|
|
15866
15873
|
src = { x: r.sx, y: r.sy, w: r.sw, h: r.sh };
|
|
15867
15874
|
}
|
|
15868
|
-
const
|
|
15869
|
-
const
|
|
15875
|
+
const tw = dctx.projector.tileWidth;
|
|
15876
|
+
const w = node.width !== void 0 ? node.width * tw : src ? src.w : tex.width;
|
|
15877
|
+
const h = node.height !== void 0 ? node.height * tw : src ? src.h : tex.height;
|
|
15870
15878
|
const anchor = node.anchor ?? "top-left";
|
|
15871
15879
|
const p = dctx.projector.anchorPoint(node.position, anchor);
|
|
15872
15880
|
const dx = anchor === "top-left" ? p.x : p.x - w / 2;
|
|
@@ -15913,27 +15921,30 @@ var init_DrawShape = __esm({
|
|
|
15913
15921
|
}
|
|
15914
15922
|
case "rect": {
|
|
15915
15923
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "top-left");
|
|
15916
|
-
const
|
|
15917
|
-
const
|
|
15918
|
-
const
|
|
15919
|
-
const
|
|
15924
|
+
const tw = dctx.projector.tileWidth;
|
|
15925
|
+
const x = p.x + (node.offsetX ?? 0) * tw;
|
|
15926
|
+
const y = p.y + (node.offsetY ?? 0) * tw;
|
|
15927
|
+
const w = (node.width ?? 0) * tw;
|
|
15928
|
+
const h = (node.height ?? 0) * tw;
|
|
15920
15929
|
if (node.fill) painter.fillRect(x, y, w, h, node.fill);
|
|
15921
15930
|
if (node.stroke) painter.strokeRect(x, y, w, h, node.stroke, node.strokeWidth ?? 1);
|
|
15922
15931
|
break;
|
|
15923
15932
|
}
|
|
15924
15933
|
case "ellipse": {
|
|
15925
15934
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "ground");
|
|
15926
|
-
const
|
|
15927
|
-
const
|
|
15928
|
-
const
|
|
15929
|
-
const
|
|
15935
|
+
const tw = dctx.projector.tileWidth;
|
|
15936
|
+
const cx = p.x + (node.offsetX ?? 0) * tw;
|
|
15937
|
+
const cy = p.y + (node.offsetY ?? 0) * tw;
|
|
15938
|
+
const rx = (node.radiusX ?? 0) * tw;
|
|
15939
|
+
const ry = (node.radiusY ?? rx) * tw;
|
|
15930
15940
|
if (node.fill) painter.fillEllipse(cx, cy, rx, ry, node.fill);
|
|
15931
15941
|
if (node.stroke) painter.strokeEllipse(cx, cy, rx, ry, node.stroke, node.strokeWidth ?? 1);
|
|
15932
15942
|
break;
|
|
15933
15943
|
}
|
|
15934
15944
|
case "poly": {
|
|
15935
15945
|
const base = dctx.projector.project(node.position);
|
|
15936
|
-
const
|
|
15946
|
+
const tw = dctx.projector.tileWidth;
|
|
15947
|
+
const pts = (node.points ?? []).map((pt) => ({ x: base.x + pt.x * tw, y: base.y + pt.y * tw }));
|
|
15937
15948
|
if (node.fill) painter.fillPoly(pts, node.fill);
|
|
15938
15949
|
if (node.stroke) painter.strokePoly(pts, node.stroke, node.strokeWidth ?? 1, true);
|
|
15939
15950
|
break;
|
|
@@ -16164,10 +16175,12 @@ function Canvas2D({
|
|
|
16164
16175
|
const canvas = canvasRef.current;
|
|
16165
16176
|
if (!canvas) return;
|
|
16166
16177
|
bindCanvasCapture(() => canvas.toDataURL("image/png"));
|
|
16178
|
+
bindLastDrawables(() => drawables ?? null);
|
|
16167
16179
|
return () => {
|
|
16168
16180
|
bindCanvasCapture(() => null);
|
|
16181
|
+
bindLastDrawables(() => null);
|
|
16169
16182
|
};
|
|
16170
|
-
}, []);
|
|
16183
|
+
}, [drawables]);
|
|
16171
16184
|
const enableCamera = camera === "pan-zoom";
|
|
16172
16185
|
const {
|
|
16173
16186
|
cameraRef,
|
|
@@ -16182,7 +16195,7 @@ function Canvas2D({
|
|
|
16182
16195
|
screenToWorld,
|
|
16183
16196
|
lerpToTarget
|
|
16184
16197
|
} = useCamera();
|
|
16185
|
-
const [, setAtlasVersion] = React73.useState(0);
|
|
16198
|
+
const [atlasVersion, setAtlasVersion] = React73.useState(0);
|
|
16186
16199
|
const bumpAtlas = React73.useCallback(() => setAtlasVersion((v) => v + 1), []);
|
|
16187
16200
|
const miniMapTiles = React73.useMemo(() => {
|
|
16188
16201
|
if (!showMinimap) return [];
|
|
@@ -16250,6 +16263,9 @@ function Canvas2D({
|
|
|
16250
16263
|
React73.useEffect(() => {
|
|
16251
16264
|
draw();
|
|
16252
16265
|
}, [_imagePendingCount, draw]);
|
|
16266
|
+
React73.useEffect(() => {
|
|
16267
|
+
draw();
|
|
16268
|
+
}, [atlasVersion, draw]);
|
|
16253
16269
|
React73.useEffect(() => {
|
|
16254
16270
|
if (camera !== "follow" || !followTarget) return;
|
|
16255
16271
|
let running = true;
|
package/dist/components/index.js
CHANGED
|
@@ -15258,6 +15258,13 @@ function bindCanvasCapture(captureFn) {
|
|
|
15258
15258
|
window.__orbitalVerification.captureFrame = captureFn;
|
|
15259
15259
|
}
|
|
15260
15260
|
}
|
|
15261
|
+
function bindLastDrawables(getDrawables) {
|
|
15262
|
+
if (typeof window === "undefined") return;
|
|
15263
|
+
exposeOnWindow();
|
|
15264
|
+
if (window.__orbitalVerification) {
|
|
15265
|
+
window.__orbitalVerification.getLastDrawables = getDrawables;
|
|
15266
|
+
}
|
|
15267
|
+
}
|
|
15261
15268
|
function updateAssetStatus(url, status) {
|
|
15262
15269
|
if (typeof window === "undefined") return;
|
|
15263
15270
|
exposeOnWindow();
|
|
@@ -15820,8 +15827,9 @@ var init_DrawSprite = __esm({
|
|
|
15820
15827
|
if (!r) return;
|
|
15821
15828
|
src = { x: r.sx, y: r.sy, w: r.sw, h: r.sh };
|
|
15822
15829
|
}
|
|
15823
|
-
const
|
|
15824
|
-
const
|
|
15830
|
+
const tw = dctx.projector.tileWidth;
|
|
15831
|
+
const w = node.width !== void 0 ? node.width * tw : src ? src.w : tex.width;
|
|
15832
|
+
const h = node.height !== void 0 ? node.height * tw : src ? src.h : tex.height;
|
|
15825
15833
|
const anchor = node.anchor ?? "top-left";
|
|
15826
15834
|
const p = dctx.projector.anchorPoint(node.position, anchor);
|
|
15827
15835
|
const dx = anchor === "top-left" ? p.x : p.x - w / 2;
|
|
@@ -15868,27 +15876,30 @@ var init_DrawShape = __esm({
|
|
|
15868
15876
|
}
|
|
15869
15877
|
case "rect": {
|
|
15870
15878
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "top-left");
|
|
15871
|
-
const
|
|
15872
|
-
const
|
|
15873
|
-
const
|
|
15874
|
-
const
|
|
15879
|
+
const tw = dctx.projector.tileWidth;
|
|
15880
|
+
const x = p.x + (node.offsetX ?? 0) * tw;
|
|
15881
|
+
const y = p.y + (node.offsetY ?? 0) * tw;
|
|
15882
|
+
const w = (node.width ?? 0) * tw;
|
|
15883
|
+
const h = (node.height ?? 0) * tw;
|
|
15875
15884
|
if (node.fill) painter.fillRect(x, y, w, h, node.fill);
|
|
15876
15885
|
if (node.stroke) painter.strokeRect(x, y, w, h, node.stroke, node.strokeWidth ?? 1);
|
|
15877
15886
|
break;
|
|
15878
15887
|
}
|
|
15879
15888
|
case "ellipse": {
|
|
15880
15889
|
const p = dctx.projector.anchorPoint(node.position, node.anchor ?? "ground");
|
|
15881
|
-
const
|
|
15882
|
-
const
|
|
15883
|
-
const
|
|
15884
|
-
const
|
|
15890
|
+
const tw = dctx.projector.tileWidth;
|
|
15891
|
+
const cx = p.x + (node.offsetX ?? 0) * tw;
|
|
15892
|
+
const cy = p.y + (node.offsetY ?? 0) * tw;
|
|
15893
|
+
const rx = (node.radiusX ?? 0) * tw;
|
|
15894
|
+
const ry = (node.radiusY ?? rx) * tw;
|
|
15885
15895
|
if (node.fill) painter.fillEllipse(cx, cy, rx, ry, node.fill);
|
|
15886
15896
|
if (node.stroke) painter.strokeEllipse(cx, cy, rx, ry, node.stroke, node.strokeWidth ?? 1);
|
|
15887
15897
|
break;
|
|
15888
15898
|
}
|
|
15889
15899
|
case "poly": {
|
|
15890
15900
|
const base = dctx.projector.project(node.position);
|
|
15891
|
-
const
|
|
15901
|
+
const tw = dctx.projector.tileWidth;
|
|
15902
|
+
const pts = (node.points ?? []).map((pt) => ({ x: base.x + pt.x * tw, y: base.y + pt.y * tw }));
|
|
15892
15903
|
if (node.fill) painter.fillPoly(pts, node.fill);
|
|
15893
15904
|
if (node.stroke) painter.strokePoly(pts, node.stroke, node.strokeWidth ?? 1, true);
|
|
15894
15905
|
break;
|
|
@@ -16119,10 +16130,12 @@ function Canvas2D({
|
|
|
16119
16130
|
const canvas = canvasRef.current;
|
|
16120
16131
|
if (!canvas) return;
|
|
16121
16132
|
bindCanvasCapture(() => canvas.toDataURL("image/png"));
|
|
16133
|
+
bindLastDrawables(() => drawables ?? null);
|
|
16122
16134
|
return () => {
|
|
16123
16135
|
bindCanvasCapture(() => null);
|
|
16136
|
+
bindLastDrawables(() => null);
|
|
16124
16137
|
};
|
|
16125
|
-
}, []);
|
|
16138
|
+
}, [drawables]);
|
|
16126
16139
|
const enableCamera = camera === "pan-zoom";
|
|
16127
16140
|
const {
|
|
16128
16141
|
cameraRef,
|
|
@@ -16137,7 +16150,7 @@ function Canvas2D({
|
|
|
16137
16150
|
screenToWorld,
|
|
16138
16151
|
lerpToTarget
|
|
16139
16152
|
} = useCamera();
|
|
16140
|
-
const [, setAtlasVersion] = useState(0);
|
|
16153
|
+
const [atlasVersion, setAtlasVersion] = useState(0);
|
|
16141
16154
|
const bumpAtlas = useCallback(() => setAtlasVersion((v) => v + 1), []);
|
|
16142
16155
|
const miniMapTiles = useMemo(() => {
|
|
16143
16156
|
if (!showMinimap) return [];
|
|
@@ -16205,6 +16218,9 @@ function Canvas2D({
|
|
|
16205
16218
|
useEffect(() => {
|
|
16206
16219
|
draw();
|
|
16207
16220
|
}, [_imagePendingCount, draw]);
|
|
16221
|
+
useEffect(() => {
|
|
16222
|
+
draw();
|
|
16223
|
+
}, [atlasVersion, draw]);
|
|
16208
16224
|
useEffect(() => {
|
|
16209
16225
|
if (camera !== "follow" || !followTarget) return;
|
|
16210
16226
|
let running = true;
|