@holtjs/stage 0.10.1 → 0.10.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.
@@ -155,6 +155,12 @@ declare class Camera {
155
155
  stepFollow(deltaMs: number): void;
156
156
  /** Recompute `worldView` and world->canvas `matrixCombined`. */
157
157
  syncMetrics(): void;
158
+ /**
159
+ * Compute the world/HUD -> backing-canvas transform matrix for a root node with `(scrollFactorX, scrollFactorY)`,
160
+ * honoring `configureHiDpi()` (`this.dpr`) so `scrollFactor = 0` HUDs, `mountStage25D.root`, and lightmap overlays
161
+ * remain anchored at logical `(0, 0)..(viewportW, viewportH)` on 2x/3x Retina displays.
162
+ */
163
+ matrixForScrollFactor(sfX: number, sfY: number, out: Matrix2D): Matrix2D;
158
164
  }
159
165
  type DisplayObjectType = 'Image' | 'Sprite' | 'NineSlice' | 'TileSprite' | 'Rectangle' | 'Panel' | 'MsdfIcon' | 'Text' | 'Graphics' | 'Blitter' | 'InstancedBatch' | 'ShapeBatch' | 'Container' | 'CustomPass';
160
166
  type SceneHostLike = Scene;
@@ -1,6 +1,6 @@
1
1
  import { _ as rgbToCss, a as EventEmitter, c as Scale, h as packColorAbgr, l as Scenes, m as createMatrix2D, o as FilterMode, p as WHITE_RGB, r as BlendModes, u as TintModes } from "./types-CXsCvp1p.js";
2
2
  import { AnimationManager } from "./anims.js";
3
- import { i as Camera, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-BZ3J971y.js";
3
+ import { i as Camera, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-CHw-NNh2.js";
4
4
  import { c as InstancedBatchObject, d as PanelObject, f as RectangleObject, g as TileSpriteObject, h as TextObject, i as DisplayList, l as MsdfIconObject, m as SpriteObject, n as Container, o as Graphics, p as ShapeBatchObject, r as CustomPassObject, s as ImageObject, t as BlitterObject, u as NineSliceObject } from "./display-DU4edtH-.js";
5
5
  import { TweenManager } from "./tween.js";
6
6
  import { StageKernel } from "./kernel.js";
@@ -4107,21 +4107,7 @@ var RendererGl = class extends EventEmitter {
4107
4107
  let baseMat = parentMat;
4108
4108
  if (!baseMat) {
4109
4109
  if (obj.scrollFactorX === 1 && obj.scrollFactorY === 1) baseMat = camera.matrixCombined;
4110
- else {
4111
- const z = camera.zoom || 1;
4112
- const ox = camera.width * camera.originX;
4113
- const oy = camera.height * camera.originY;
4114
- const sx = camera.roundPixels ? Math.round(camera.scrollX) : camera.scrollX;
4115
- const sy = camera.roundPixels ? Math.round(camera.scrollY) : camera.scrollY;
4116
- const sm = this.sfMat;
4117
- sm.a = z;
4118
- sm.b = 0;
4119
- sm.c = 0;
4120
- sm.d = z;
4121
- sm.tx = (-sx * obj.scrollFactorX - ox) * z + ox + camera.x;
4122
- sm.ty = (-sy * obj.scrollFactorY - oy) * z + oy + camera.y;
4123
- baseMat = sm;
4124
- }
4110
+ else baseMat = camera.matrixForScrollFactor(obj.scrollFactorX, obj.scrollFactorY, this.sfMat);
4125
4111
  }
4126
4112
  let m;
4127
4113
  if (obj.x === 0 && obj.y === 0 && obj.scaleX === 1 && obj.scaleY === 1 && obj.rotation === 0 && obj.skewX === 0 && obj.skewY === 0) m = baseMat;
@@ -1,4 +1,4 @@
1
- import { E as StagePlugin, L as SceneDigestOptions, N as SceneDigest, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-B7w2sF5C.js";
1
+ import { E as StagePlugin, L as SceneDigestOptions, N as SceneDigest, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-B_hIy548.js";
2
2
  /** Minimal Canvas2D surface compatible with `@napi-rs/canvas`, `node-canvas`, and browser `<canvas>`. */
3
3
  export interface HeadlessCanvasLike {
4
4
  width: number;
package/dist/headless.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./types-CXsCvp1p.js";
2
- import { n as Game } from "./game-CnGm5bly.js";
2
+ import { n as Game } from "./game-BnozPxF8.js";
3
3
  import { buildSceneDigest } from "./trace.js";
4
4
  // src/headless.ts
5
5
  function createVirtualDomHost(createCanvas, width, height) {
@@ -123,29 +123,33 @@ function createHeadlessStage(options) {
123
123
  return game.clock.snapshot();
124
124
  };
125
125
  const toRgbaInto = (out) => {
126
- const byteLen = width * height * 4;
126
+ const cw = rootCanvas.width || width;
127
+ const ch = rootCanvas.height || height;
128
+ const byteLen = cw * ch * 4;
127
129
  const dst = out && out.byteLength >= byteLen ? out : new Uint8Array(byteLen);
128
130
  if (game.renderer.type === 2 && game.renderer.gl) {
129
131
  const gl = game.renderer.gl;
130
- gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, dst);
132
+ gl.readPixels(0, 0, cw, ch, gl.RGBA, gl.UNSIGNED_BYTE, dst);
131
133
  return dst;
132
134
  }
133
135
  const ctx = rootCanvas.getContext("2d");
134
136
  if (!ctx) throw new Error("HeadlessStage.toRgbaInto: 2D context unavailable");
135
- const img = ctx.getImageData(0, 0, width, height);
137
+ const img = ctx.getImageData(0, 0, cw, ch);
136
138
  dst.set(img.data.subarray(0, byteLen));
137
139
  return dst;
138
140
  };
139
141
  const toRgba = () => {
142
+ const cw = rootCanvas.width || width;
143
+ const ch = rootCanvas.height || height;
140
144
  if (game.renderer.type === 2 && game.renderer.gl) {
141
145
  const gl = game.renderer.gl;
142
- const out = new Uint8Array(width * height * 4);
143
- gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, out);
146
+ const out = new Uint8Array(cw * ch * 4);
147
+ gl.readPixels(0, 0, cw, ch, gl.RGBA, gl.UNSIGNED_BYTE, out);
144
148
  return out;
145
149
  }
146
150
  const ctx = rootCanvas.getContext("2d");
147
151
  if (!ctx) throw new Error("HeadlessStage.toRgba: 2D context unavailable");
148
- const img = ctx.getImageData(0, 0, width, height);
152
+ const img = ctx.getImageData(0, 0, cw, ch);
149
153
  return new Uint8Array(img.data.buffer, img.data.byteOffset, img.data.byteLength);
150
154
  };
151
155
  const toPng = () => {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as NineSliceObject, B as SceneDigestSurfaceEntry, Bt as SpriteAnimEventListener, C as RecordedInputEntry, Ct as EquipmentBinding, D as TimelineClickOptions, Dt as InstancedColumns, E as StagePlugin, Et as InstancedBatchObject, F as SceneDigestEngineSandbox, Ft as RectangleObject, G as InputConfig, Gt as TextStyleConfig, H as SceneDigestSurfaces, Ht as SpritePlayOptions, I as SceneDigestNode, It as SceneHostLike, J as Pointer, Jt as CameraFollowOptions, K as InputPlugin, Kt as TileSpriteObject, L as SceneDigestOptions, Lt as ShapeBatchColumns, M as createInputTimeline, Mt as PanelOpenSide, N as SceneDigest, Nt as PanelStyleConfig, O as TimelineDragOptions, Ot as MsdfIconConfig, P as SceneDigestActiveFocus, Pt as RectClipMask, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as ShapeBatchObject, S as InputTimelinePlugin, St as DisplaySemantics, T as StageKernel, Tt as ImageObject, U as buildSceneDigest, Ut as SyncAttachmentOptions, V as SceneDigestSurfaceSource, Vt as SpriteObject, W as sanitizeTrackToken, Wt as TextObject, X as RendererWebGpu, Xt as HiDpiScaleLike, Y as PointerSample, Yt as HiDpiConfigureOptions, Z as RendererWebGpuOptions, _ as ActionMap, _t as CustomPassOptions, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplayObject, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as BlitterObject, et as WebGpuCanvasContextLike, f as SceneInput, ft as Bob$1, g as ViewportFitResult, gt as CustomPassObject, h as StageRenderer, ht as CustomPassCallback, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as PanelObject, k as TimelineKeyOptions, kt as MsdfIconObject, l as ScaleManager, lt as AnchorPose2D, m as SceneManager, mt as ContainerFiltersShim, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as Container, q as KeyboardPlugin, qt as Camera, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as BindEquipmentOptions, v as InputProvider, vt as DirectionalPlayOptions, w as StageInputEvent, wt as Graphics, x as InputTimelineOptions, xt as DisplayObjectType, y as InputRecorderPlugin, yt as DisplayList, z as SceneDigestSandbox, zt as ShapeBatchStyleDefaults } from "./game-B7w2sF5C.js";
1
+ import { $ as WebGpuBootstrapResult, A as createInputRecorder, At as NineSliceObject, B as SceneDigestSurfaceEntry, Bt as SpriteAnimEventListener, C as RecordedInputEntry, Ct as EquipmentBinding, D as TimelineClickOptions, Dt as InstancedColumns, E as StagePlugin, Et as InstancedBatchObject, F as SceneDigestEngineSandbox, Ft as RectangleObject, G as InputConfig, Gt as TextStyleConfig, H as SceneDigestSurfaces, Ht as SpritePlayOptions, I as SceneDigestNode, It as SceneHostLike, J as Pointer, Jt as CameraFollowOptions, K as InputPlugin, Kt as TileSpriteObject, L as SceneDigestOptions, Lt as ShapeBatchColumns, M as createInputTimeline, Mt as PanelOpenSide, N as SceneDigest, Nt as PanelStyleConfig, O as TimelineDragOptions, Ot as MsdfIconConfig, P as SceneDigestActiveFocus, Pt as RectClipMask, Q as RequestWebGpuOptions, R as SceneDigestOverlayStats, Rt as ShapeBatchObject, S as InputTimelinePlugin, St as DisplaySemantics, T as StageKernel, Tt as ImageObject, U as buildSceneDigest, Ut as SyncAttachmentOptions, V as SceneDigestSurfaceSource, Vt as SpriteObject, W as sanitizeTrackToken, Wt as TextObject, X as RendererWebGpu, Xt as HiDpiScaleLike, Y as PointerSample, Yt as HiDpiConfigureOptions, Z as RendererWebGpuOptions, _ as ActionMap, _t as CustomPassOptions, a as GameLoop, at as RendererGlOptions, b as InputTargetSpec, bt as DisplayObject, c as LoaderPlugin, ct as StageRenderTarget, d as SceneCtor, dt as BlitterObject, et as WebGpuCanvasContextLike, f as SceneInput, ft as Bob$1, g as ViewportFitResult, gt as CustomPassObject, h as StageRenderer, ht as CustomPassCallback, i as GameConfig$1, it as RendererGl, j as createInputReplay, jt as PanelObject, k as TimelineKeyOptions, kt as MsdfIconObject, l as ScaleManager, lt as AnchorPose2D, m as SceneManager, mt as ContainerFiltersShim, n as EngineClockSnapshot, nt as requestWebGpuDevice, o as GameObjectFactory, ot as RendererStats, p as SceneLifecycleStats, pt as Container, q as KeyboardPlugin, qt as Camera, r as Game, rt as Renderer2D, s as JsonCache, st as Stage2DCustomImageHandler, t as EngineClock, tt as WebGpuDeviceLike, u as Scene, ut as BindEquipmentOptions, v as InputProvider, vt as DirectionalPlayOptions, w as StageInputEvent, wt as Graphics, x as InputTimelineOptions, xt as DisplayObjectType, y as InputRecorderPlugin, yt as DisplayList, z as SceneDigestSandbox, zt as ShapeBatchStyleDefaults } from "./game-B_hIy548.js";
2
2
  import { A as FilterModeValue, B as WEBGL, C as AUTO, D as CANVAS, E as BlendModes, F as Scale, G as packColorAbgr, H as WHITE_RGB, I as ScaleMode, K as parseColor, L as Scenes, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, V as WEBGPU, W as createMatrix2D, _ as SpriteSheetConfig, a as AtlasClipRule, b as TextureImageSource, c as GenerateFrameNamesConfig, d as AtlasJsonLike, f as CanvasTexture, g as GlTextureHost, h as FrameExtraMeta, i as AtlasAutoAnimOptions, j as HEX_MASK, k as FilterMode, l as GenerateFrameNumbersConfig, m as FrameAnchorTuple, n as AnimationFrameInput, o as CompiledAnimationFrame, p as Frame, q as rgbToCss, r as AnimationManager, s as DirectionalAnimGroup, t as AnimationConfig, u as StageAnimation, v as Texture, w as BLACK_RGB, x as TextureManager, y as TextureImageOptions, z as TintModes } from "./anims-D9N8w6IM.js";
3
3
  import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
4
4
  import { a as SpringHandle, c as TweenManager, i as Easings, l as TweenOptions, n as EasingFn, o as SpringOptions, r as EasingName, s as TweenHandle, t as DisposableOwner, u as TweenStats } from "./tween-BiF1FUvc.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { _ as rgbToCss, a as EventEmitter, c as Scale, d as WEBGL, f as WEBGPU, g as parseColor, h as packColorAbgr, i as CANVAS, l as Scenes, m as createMatrix2D, n as BLACK_RGB, o as FilterMode, p as WHITE_RGB, r as BlendModes, s as HEX_MASK, t as AUTO, u as TintModes } from "./types-CXsCvp1p.js";
2
- import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-CnGm5bly.js";
2
+ import { _ as CanvasTexture, a as JsonCache, b as TextureManager, c as Scene, d as KeyboardPlugin, f as Pointer, g as SdfPanelBatcher, h as MsdfIconBatcher, i as GameObjectFactory, l as SceneManager, m as PixelAaBatcher, n as Game, o as LoaderPlugin, p as RendererGl, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Frame, x as TextureSource, y as Texture } from "./game-BnozPxF8.js";
3
3
  import { AnimationManager } from "./anims.js";
4
- import { i as Camera, n as requestWebGpuDevice, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-BZ3J971y.js";
4
+ import { i as Camera, n as requestWebGpuDevice, r as Renderer2D, t as RendererWebGpu } from "./renderer-webgpu-CHw-NNh2.js";
5
5
  import { a as DisplayObject, c as InstancedBatchObject, d as PanelObject, f as RectangleObject, g as TileSpriteObject, h as TextObject, i as DisplayList, l as MsdfIconObject, m as SpriteObject, n as Container, o as Graphics, p as ShapeBatchObject, r as CustomPassObject, s as ImageObject, t as BlitterObject, u as NineSliceObject } from "./display-DU4edtH-.js";
6
6
  import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
7
7
  import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
@@ -1,4 +1,4 @@
1
- import { J as Pointer, jt as PanelObject, pt as Container, u as Scene } from "./game-B7w2sF5C.js";
1
+ import { J as Pointer, jt as PanelObject, pt as Container, u as Scene } from "./game-B_hIy548.js";
2
2
  export type VirtualJoystickMode = 'floating' | 'fixed';
3
3
  export interface JoystickVector {
4
4
  /** Normalized X axis in [-1, 1] after deadzone remapping. */
package/dist/kernel.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as createInputRecorder, C as RecordedInputEntry, D as TimelineClickOptions, E as StagePlugin, M as createInputTimeline, O as TimelineDragOptions, S as InputTimelinePlugin, T as StageKernel, _ as ActionMap, b as InputTargetSpec, j as createInputReplay, k as TimelineKeyOptions, v as InputProvider, w as StageInputEvent, x as InputTimelineOptions, y as InputRecorderPlugin } from "./game-B7w2sF5C.js";
1
+ import { A as createInputRecorder, C as RecordedInputEntry, D as TimelineClickOptions, E as StagePlugin, M as createInputTimeline, O as TimelineDragOptions, S as InputTimelinePlugin, T as StageKernel, _ as ActionMap, b as InputTargetSpec, j as createInputReplay, k as TimelineKeyOptions, v as InputProvider, w as StageInputEvent, x as InputTimelineOptions, y as InputRecorderPlugin } from "./game-B_hIy548.js";
2
2
  export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
@@ -1,4 +1,4 @@
1
- import { It as SceneHostLike, Tt as ImageObject, bt as DisplayObject, gt as CustomPassObject, pt as Container } from "./game-B7w2sF5C.js";
1
+ import { It as SceneHostLike, Tt as ImageObject, bt as DisplayObject, gt as CustomPassObject, pt as Container } from "./game-B_hIy548.js";
2
2
  export type DayPhase = 'day' | 'dusk' | 'night';
3
3
  export interface DayNightConfig {
4
4
  dayLengthMs?: number;
package/dist/lighting.js CHANGED
@@ -303,15 +303,16 @@ function computeNodeScreenMatrix(node, scene, out) {
303
303
  break;
304
304
  }
305
305
  const cam = scene.cameras.main;
306
+ const invDpr = cam.dpr > 0 && cam.dpr !== 1 ? 1 / cam.dpr : 1;
306
307
  if (sfX === 1 && sfY === 1) {
307
308
  cam.syncMetrics();
308
309
  const cm = cam.matrixCombined;
309
- const na = cm.a * out.a + cm.c * out.b;
310
- const nb = cm.b * out.a + cm.d * out.b;
311
- const nc = cm.a * out.c + cm.c * out.d;
312
- const nd = cm.b * out.c + cm.d * out.d;
313
- const ntx = cm.a * out.tx + cm.c * out.ty + cm.tx;
314
- const nty = cm.b * out.tx + cm.d * out.ty + cm.ty;
310
+ const na = (cm.a * out.a + cm.c * out.b) * invDpr;
311
+ const nb = (cm.b * out.a + cm.d * out.b) * invDpr;
312
+ const nc = (cm.a * out.c + cm.c * out.d) * invDpr;
313
+ const nd = (cm.b * out.c + cm.d * out.d) * invDpr;
314
+ const ntx = (cm.a * out.tx + cm.c * out.ty + cm.tx) * invDpr;
315
+ const nty = (cm.b * out.tx + cm.d * out.ty + cm.ty) * invDpr;
315
316
  out.a = na;
316
317
  out.b = nb;
317
318
  out.c = nc;
@@ -319,19 +320,14 @@ function computeNodeScreenMatrix(node, scene, out) {
319
320
  out.tx = ntx;
320
321
  out.ty = nty;
321
322
  } else if (sfX !== 0 || sfY !== 0) {
322
- const z = cam.zoom || 1;
323
- const ox = cam.width * cam.originX;
324
- const oy = cam.height * cam.originY;
325
- const sx = cam.roundPixels ? Math.round(cam.scrollX) : cam.scrollX;
326
- const sy = cam.roundPixels ? Math.round(cam.scrollY) : cam.scrollY;
327
- const tx = (-sx * sfX - ox) * z + ox + cam.x;
328
- const ty = (-sy * sfY - oy) * z + oy + cam.y;
329
- out.a *= z;
330
- out.b *= z;
331
- out.c *= z;
332
- out.d *= z;
333
- out.tx = out.tx * z + tx;
334
- out.ty = out.ty * z + ty;
323
+ const sm = createMatrix2D();
324
+ cam.matrixForScrollFactor(sfX, sfY, sm);
325
+ out.a = out.a * sm.a * invDpr;
326
+ out.b = out.b * sm.d * invDpr;
327
+ out.c = out.c * sm.a * invDpr;
328
+ out.d = out.d * sm.d * invDpr;
329
+ out.tx = (out.tx * sm.a + sm.tx) * invDpr;
330
+ out.ty = (out.ty * sm.d + sm.ty) * invDpr;
335
331
  }
336
332
  out.scaleX = Math.hypot(out.a, out.b);
337
333
  out.scaleY = Math.hypot(out.c, out.d);
@@ -1,4 +1,4 @@
1
- import { It as SceneHostLike, bt as DisplayObject, pt as Container } from "./game-B7w2sF5C.js";
1
+ import { It as SceneHostLike, bt as DisplayObject, pt as Container } from "./game-B_hIy548.js";
2
2
  export interface Camera25DConfig {
3
3
  viewportWidth: number;
4
4
  viewportHeight: number;
@@ -306,6 +306,32 @@ var Camera = class {
306
306
  m.scaleX = z;
307
307
  m.scaleY = z;
308
308
  }
309
+ /**
310
+ * Compute the world/HUD -> backing-canvas transform matrix for a root node with `(scrollFactorX, scrollFactorY)`,
311
+ * honoring `configureHiDpi()` (`this.dpr`) so `scrollFactor = 0` HUDs, `mountStage25D.root`, and lightmap overlays
312
+ * remain anchored at logical `(0, 0)..(viewportW, viewportH)` on 2x/3x Retina displays.
313
+ */
314
+ matrixForScrollFactor(sfX, sfY, out) {
315
+ const z = this.zoom || 1;
316
+ const dpr = this.dpr > 0 ? this.dpr : 1;
317
+ const ox = this.width * this.originX;
318
+ const oy = this.height * this.originY;
319
+ const sx = this.roundPixels ? Math.round(this.scrollX) : this.scrollX;
320
+ const sy = this.roundPixels ? Math.round(this.scrollY) : this.scrollY;
321
+ const sx0 = dpr !== 1 ? ox / dpr - ox : 0;
322
+ const sy0 = dpr !== 1 ? oy / dpr - oy : 0;
323
+ const effSx = (sx - sx0) * sfX + sx0;
324
+ const effSy = (sy - sy0) * sfY + sy0;
325
+ out.a = z;
326
+ out.b = 0;
327
+ out.c = 0;
328
+ out.d = z;
329
+ out.tx = (-effSx - ox) * z + ox + this.x;
330
+ out.ty = (-effSy - oy) * z + oy + this.y;
331
+ out.scaleX = z;
332
+ out.scaleY = z;
333
+ return out;
334
+ }
309
335
  };
310
336
  // src/renderer-2d.ts
311
337
  function addPerCornerRoundedRectSubpath(ctx, x, y, w, h, tl, tr, br, bl) {
@@ -1382,21 +1408,7 @@ var Renderer2D = class Renderer2D extends EventEmitter {
1382
1408
  let baseMat;
1383
1409
  if (parentMat === null) {
1384
1410
  if (obj.scrollFactorX === 1 && obj.scrollFactorY === 1) baseMat = camera.matrixCombined;
1385
- else {
1386
- const z = camera.zoom || 1;
1387
- const ox = camera.width * camera.originX;
1388
- const oy = camera.height * camera.originY;
1389
- const sx = camera.roundPixels ? Math.round(camera.scrollX) : camera.scrollX;
1390
- const sy = camera.roundPixels ? Math.round(camera.scrollY) : camera.scrollY;
1391
- const rm = this.rootScrollMat;
1392
- rm.a = z;
1393
- rm.b = 0;
1394
- rm.c = 0;
1395
- rm.d = z;
1396
- rm.tx = (-sx * obj.scrollFactorX - ox) * z + ox + camera.x;
1397
- rm.ty = (-sy * obj.scrollFactorY - oy) * z + oy + camera.y;
1398
- baseMat = rm;
1399
- }
1411
+ else baseMat = camera.matrixForScrollFactor(obj.scrollFactorX, obj.scrollFactorY, this.rootScrollMat);
1400
1412
  } else baseMat = parentMat;
1401
1413
  while (depth >= this.matPool.length) this.matPool.push(createMatrix2D());
1402
1414
  const m = this.mulMat(baseMat, obj.x, obj.y, obj.scaleX, obj.scaleY, obj.rotation, this.matPool[depth], obj.skewX, obj.skewY);
@@ -2501,21 +2513,7 @@ var RendererWebGpu = class extends EventEmitter {
2501
2513
  let baseMat = parentMat;
2502
2514
  if (!baseMat) {
2503
2515
  if (obj.scrollFactorX === 1 && obj.scrollFactorY === 1) baseMat = camera.matrixCombined;
2504
- else {
2505
- const z = camera.zoom || 1;
2506
- const ox = camera.width * camera.originX;
2507
- const oy = camera.height * camera.originY;
2508
- const sx = camera.roundPixels ? Math.round(camera.scrollX) : camera.scrollX;
2509
- const sy = camera.roundPixels ? Math.round(camera.scrollY) : camera.scrollY;
2510
- const sm = this.sfMat;
2511
- sm.a = z;
2512
- sm.b = 0;
2513
- sm.c = 0;
2514
- sm.d = z;
2515
- sm.tx = (-sx * obj.scrollFactorX - ox) * z + ox + camera.x;
2516
- sm.ty = (-sy * obj.scrollFactorY - oy) * z + oy + camera.y;
2517
- baseMat = sm;
2518
- }
2516
+ else baseMat = camera.matrixForScrollFactor(obj.scrollFactorX, obj.scrollFactorY, this.sfMat);
2519
2517
  }
2520
2518
  let m;
2521
2519
  if (obj.x === 0 && obj.y === 0 && obj.scaleX === 1 && obj.scaleY === 1 && obj.rotation === 0 && obj.skewX === 0 && obj.skewY === 0) m = baseMat;
@@ -1,2 +1,2 @@
1
- import { $ as WebGpuBootstrapResult, Q as RequestWebGpuOptions, X as RendererWebGpu, Z as RendererWebGpuOptions, et as WebGpuCanvasContextLike, nt as requestWebGpuDevice, tt as WebGpuDeviceLike } from "./game-B7w2sF5C.js";
1
+ import { $ as WebGpuBootstrapResult, Q as RequestWebGpuOptions, X as RendererWebGpu, Z as RendererWebGpuOptions, et as WebGpuCanvasContextLike, nt as requestWebGpuDevice, tt as WebGpuDeviceLike } from "./game-B_hIy548.js";
2
2
  export { RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, requestWebGpuDevice };
@@ -1 +1 @@
1
- export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-BZ3J971y.js";
1
+ export { t as RendererWebGpu, n as requestWebGpuDevice } from "./renderer-webgpu-CHw-NNh2.js";
package/dist/rig2d.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { T as BlendMode } from "./anims-D9N8w6IM.js";
2
- import { It as SceneHostLike, Tt as ImageObject, pt as Container, wt as Graphics } from "./game-B7w2sF5C.js";
2
+ import { It as SceneHostLike, Tt as ImageObject, pt as Container, wt as Graphics } from "./game-B_hIy548.js";
3
3
  export type RigCurveKind = 'linear' | 'step' | 'smoothstep' | 'outBack';
4
4
  export interface RigBoneDef {
5
5
  name: string;
package/dist/tilemap.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { It as SceneHostLike, dt as BlitterObject, pt as Container } from "./game-B7w2sF5C.js";
1
+ import { It as SceneHostLike, dt as BlitterObject, pt as Container } from "./game-B_hIy548.js";
2
2
  /** Pack signed 16-bit chunk coordinates `[-32768..32767]` into a single 32-bit integer Map key (zero string allocation). */
3
3
  export declare function packChunkKey(cx: number, cy: number): number;
4
4
  export declare function unpackChunkX(key: number): number;
package/dist/trace.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { B as SceneDigestSurfaceEntry, F as SceneDigestEngineSandbox, H as SceneDigestSurfaces, I as SceneDigestNode, L as SceneDigestOptions, N as SceneDigest, P as SceneDigestActiveFocus, R as SceneDigestOverlayStats, U as buildSceneDigest, V as SceneDigestSurfaceSource, W as sanitizeTrackToken, z as SceneDigestSandbox } from "./game-B7w2sF5C.js";
1
+ import { B as SceneDigestSurfaceEntry, F as SceneDigestEngineSandbox, H as SceneDigestSurfaces, I as SceneDigestNode, L as SceneDigestOptions, N as SceneDigest, P as SceneDigestActiveFocus, R as SceneDigestOverlayStats, U as buildSceneDigest, V as SceneDigestSurfaceSource, W as sanitizeTrackToken, z as SceneDigestSandbox } from "./game-B_hIy548.js";
2
2
  export { SceneDigest, SceneDigestActiveFocus, SceneDigestEngineSandbox, SceneDigestNode, SceneDigestOptions, SceneDigestOverlayStats, SceneDigestSandbox, SceneDigestSurfaceEntry, SceneDigestSurfaceSource, SceneDigestSurfaces, buildSceneDigest, sanitizeTrackToken };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holtjs/stage",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Zero-dependency TypeScript stage engine for 2D WebGPU/WebGL2/Canvas2D games, GPU SDF UI, procedural audio, StageKernel plugins, tracing-native observability, and deterministic 60 FPS headless image & video rendering.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Botiverse, Inc.",