@nexart/ui-renderer 0.8.0 → 0.8.1
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/README.md +12 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/preview/canvas-scaler.d.ts +21 -0
- package/dist/preview/canvas-scaler.d.ts.map +1 -1
- package/dist/preview/canvas-scaler.js +38 -0
- package/dist/preview/code-renderer.d.ts.map +1 -1
- package/dist/preview/code-renderer.js +6 -3
- package/dist/preview/preview-engine.d.ts.map +1 -1
- package/dist/preview/preview-engine.js +4 -1
- package/dist/preview/unified-renderer.d.ts.map +1 -1
- package/dist/preview/unified-renderer.js +5 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @nexart/ui-renderer
|
|
2
2
|
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
|
|
5
5
|
**Lightweight Preview Runtime for NexArt Protocol**
|
|
6
6
|
|
|
@@ -19,6 +19,16 @@ Version: 0.8.0
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## v0.8.1 — Canvas Scaling Fix
|
|
23
|
+
|
|
24
|
+
Fixed canvas zoom/cropping bug caused by resolution downscaling in v0.8.0.
|
|
25
|
+
|
|
26
|
+
- **Scale Transform Reapplied**: Context scale is now properly restored after canvas resize
|
|
27
|
+
- **Transform-Safe Clear**: `clearRect` now ignores active transforms for correct full-canvas clearing
|
|
28
|
+
- **No API Changes**: All fixes are internal
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
22
32
|
## v0.8.0 — Lightweight Preview Runtime
|
|
23
33
|
|
|
24
34
|
This release refactors the UI renderer into a performance-optimized preview runtime.
|
|
@@ -203,7 +213,7 @@ import { getCapabilities } from '@nexart/ui-renderer';
|
|
|
203
213
|
|
|
204
214
|
const caps = getCapabilities();
|
|
205
215
|
// {
|
|
206
|
-
// version: '0.8.
|
|
216
|
+
// version: '0.8.1',
|
|
207
217
|
// isCanonical: false,
|
|
208
218
|
// isArchival: false,
|
|
209
219
|
// previewBudget: { MAX_FRAMES: 30, MAX_TOTAL_TIME_MS: 500, FRAME_STRIDE: 3 },
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @nexart/ui-renderer
|
|
3
|
-
* Version: 0.8.
|
|
3
|
+
* Version: 0.8.1
|
|
4
4
|
*
|
|
5
5
|
* Lightweight Preview Runtime for NexArt Protocol
|
|
6
6
|
*
|
|
@@ -46,7 +46,7 @@ export { calculateScaledDimensions, applyScaledDimensions, type ScaledDimensions
|
|
|
46
46
|
export type { NexArtSystemInput, NexArtSystem, DeclarativeSystemInput, DeclarativeSystem, CodeSystem, NexArtCodeSystem, UnifiedSystemInput, UnifiedSystem, UnifiedElement, BackgroundElement, PrimitiveElement, SketchElement, BackgroundPreset, PrimitiveName, ColorPalette, MotionSpeed, StrokeWeightAuto, LoopConfig, DeclarativeElement, SystemElement, DotsElement, LinesElement, WavesElement, GridElement, FlowFieldElement, OrbitsElement, BackgroundConfig, MotionConfig, PreviewOptions, ValidationResult, } from './types';
|
|
47
47
|
export { AESTHETIC_DEFAULTS, SDK_VERSION as TYPE_SDK_VERSION } from './types';
|
|
48
48
|
export type { Capabilities, PrimitiveCapability, ParameterSpec, } from './capabilities';
|
|
49
|
-
export declare const SDK_VERSION = "0.8.
|
|
49
|
+
export declare const SDK_VERSION = "0.8.1";
|
|
50
50
|
export declare const PROTOCOL_VERSION = "0.8";
|
|
51
51
|
export declare const IS_CANONICAL = false;
|
|
52
52
|
export declare const IS_ARCHIVAL = false;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @nexart/ui-renderer
|
|
3
|
-
* Version: 0.8.
|
|
3
|
+
* Version: 0.8.1
|
|
4
4
|
*
|
|
5
5
|
* Lightweight Preview Runtime for NexArt Protocol
|
|
6
6
|
*
|
|
@@ -44,7 +44,7 @@ export { PREVIEW_BUDGET, CANVAS_LIMITS, } from './preview/preview-types';
|
|
|
44
44
|
export { createFrameBudget, canRenderFrame, recordFrame, resetBudget, shouldSkipFrame, } from './preview/frame-budget';
|
|
45
45
|
export { calculateScaledDimensions, applyScaledDimensions, } from './preview/canvas-scaler';
|
|
46
46
|
export { AESTHETIC_DEFAULTS, SDK_VERSION as TYPE_SDK_VERSION } from './types';
|
|
47
|
-
export const SDK_VERSION = '0.8.
|
|
47
|
+
export const SDK_VERSION = '0.8.1';
|
|
48
48
|
export const PROTOCOL_VERSION = '0.8';
|
|
49
49
|
export const IS_CANONICAL = false;
|
|
50
50
|
export const IS_ARCHIVAL = false;
|
|
@@ -46,4 +46,25 @@ export declare function scaleCoordinate(value: number, scaleFactor: number): num
|
|
|
46
46
|
* This allows sketches to use original coordinates while rendering at scaled resolution.
|
|
47
47
|
*/
|
|
48
48
|
export declare function applyScaleTransform(ctx: CanvasRenderingContext2D, scaleFactor: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Reapply context scale after canvas resize.
|
|
51
|
+
*
|
|
52
|
+
* NOTE:
|
|
53
|
+
* Canvas resizing resets the 2D context transform.
|
|
54
|
+
* The UI renderer downsamples the canvas for performance,
|
|
55
|
+
* so we must reapply the internal scale factor once after resize.
|
|
56
|
+
* This runtime is preview-only and intentionally non-deterministic.
|
|
57
|
+
*
|
|
58
|
+
* @param canvas - The canvas element
|
|
59
|
+
* @param dimensions - The scaled dimensions object
|
|
60
|
+
*/
|
|
61
|
+
export declare function reapplyContextScale(canvas: HTMLCanvasElement, dimensions: ScaledDimensions): void;
|
|
62
|
+
/**
|
|
63
|
+
* Clear the canvas ignoring any active transforms.
|
|
64
|
+
* Ensures full canvas is cleared even when scaled.
|
|
65
|
+
*
|
|
66
|
+
* @param ctx - The 2D rendering context
|
|
67
|
+
* @param canvas - The canvas element (for dimensions)
|
|
68
|
+
*/
|
|
69
|
+
export declare function clearCanvasIgnoringTransform(ctx: CanvasRenderingContext2D, canvas: HTMLCanvasElement): void;
|
|
49
70
|
//# sourceMappingURL=canvas-scaler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-scaler.d.ts","sourceRoot":"","sources":["../../src/preview/canvas-scaler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,gBAAgB,CA0BlB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,gBAAgB,GAC3B,IAAI,CAWN;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,wBAAwB,EAC7B,WAAW,EAAE,MAAM,GAClB,IAAI,CAIN"}
|
|
1
|
+
{"version":3,"file":"canvas-scaler.d.ts","sourceRoot":"","sources":["../../src/preview/canvas-scaler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,gBAAgB,CA0BlB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,gBAAgB,GAC3B,IAAI,CAWN;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,wBAAwB,EAC7B,WAAW,EAAE,MAAM,GAClB,IAAI,CAIN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,gBAAgB,GAC3B,IAAI,CAaN;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,wBAAwB,EAC7B,MAAM,EAAE,iBAAiB,GACxB,IAAI,CAKN"}
|
|
@@ -72,3 +72,41 @@ export function applyScaleTransform(ctx, scaleFactor) {
|
|
|
72
72
|
ctx.scale(scaleFactor, scaleFactor);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Reapply context scale after canvas resize.
|
|
77
|
+
*
|
|
78
|
+
* NOTE:
|
|
79
|
+
* Canvas resizing resets the 2D context transform.
|
|
80
|
+
* The UI renderer downsamples the canvas for performance,
|
|
81
|
+
* so we must reapply the internal scale factor once after resize.
|
|
82
|
+
* This runtime is preview-only and intentionally non-deterministic.
|
|
83
|
+
*
|
|
84
|
+
* @param canvas - The canvas element
|
|
85
|
+
* @param dimensions - The scaled dimensions object
|
|
86
|
+
*/
|
|
87
|
+
export function reapplyContextScale(canvas, dimensions) {
|
|
88
|
+
if (!dimensions.wasScaled)
|
|
89
|
+
return;
|
|
90
|
+
const ctx = canvas.getContext('2d');
|
|
91
|
+
if (!ctx)
|
|
92
|
+
return;
|
|
93
|
+
// Canvas resize resets transform — must restore it
|
|
94
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
95
|
+
// Reapply internal renderer scale (NOT clientWidth-based)
|
|
96
|
+
// This is calculated from render dimensions, not DOM size
|
|
97
|
+
const scaleFactor = dimensions.renderWidth / dimensions.originalWidth;
|
|
98
|
+
ctx.scale(scaleFactor, scaleFactor);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Clear the canvas ignoring any active transforms.
|
|
102
|
+
* Ensures full canvas is cleared even when scaled.
|
|
103
|
+
*
|
|
104
|
+
* @param ctx - The 2D rendering context
|
|
105
|
+
* @param canvas - The canvas element (for dimensions)
|
|
106
|
+
*/
|
|
107
|
+
export function clearCanvasIgnoringTransform(ctx, canvas) {
|
|
108
|
+
ctx.save();
|
|
109
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
110
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
111
|
+
ctx.restore();
|
|
112
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/code-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"code-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/code-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AA0BjE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC;CACnB;AAwBD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,cAAmB,GAC3B,YAAY,CA8Od"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { PREVIEW_BUDGET, } from './preview-types';
|
|
20
20
|
import { createFrameBudget, canRenderFrame, recordFrame, resetBudget, shouldSkipFrame, } from './frame-budget';
|
|
21
|
-
import { calculateScaledDimensions, applyScaledDimensions, } from './canvas-scaler';
|
|
21
|
+
import { calculateScaledDimensions, applyScaledDimensions, reapplyContextScale, clearCanvasIgnoringTransform, } from './canvas-scaler';
|
|
22
22
|
import { createPreviewRuntime } from './preview-runtime';
|
|
23
23
|
const PROTOCOL_VERSION = '1.2.0';
|
|
24
24
|
let activeRendererInstance = null;
|
|
@@ -57,6 +57,9 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
57
57
|
console.log(`[UIRenderer] Canvas scaled: ${system.width}x${system.height} → ${scaled.renderWidth}x${scaled.renderHeight}`);
|
|
58
58
|
}
|
|
59
59
|
applyScaledDimensions(canvas, scaled);
|
|
60
|
+
// NOTE: Canvas resizing resets the 2D context transform.
|
|
61
|
+
// Reapply scale factor once after resize for correct rendering.
|
|
62
|
+
reapplyContextScale(canvas, scaled);
|
|
60
63
|
const ctx = canvas.getContext('2d');
|
|
61
64
|
let animationId = null;
|
|
62
65
|
let isRunning = false;
|
|
@@ -173,7 +176,7 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
173
176
|
runtime.tGlobal = runtime.t;
|
|
174
177
|
}
|
|
175
178
|
try {
|
|
176
|
-
ctx
|
|
179
|
+
clearCanvasIgnoringTransform(ctx, canvas);
|
|
177
180
|
if (drawFn)
|
|
178
181
|
drawFn();
|
|
179
182
|
drawBadge();
|
|
@@ -225,7 +228,7 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
225
228
|
const destroy = () => {
|
|
226
229
|
isDestroyed = true;
|
|
227
230
|
stop();
|
|
228
|
-
ctx
|
|
231
|
+
clearCanvasIgnoringTransform(ctx, canvas);
|
|
229
232
|
runtime = null;
|
|
230
233
|
setupFn = null;
|
|
231
234
|
drawFn = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-engine.d.ts","sourceRoot":"","sources":["../../src/preview/preview-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"preview-engine.d.ts","sourceRoot":"","sources":["../../src/preview/preview-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAC;AAwMzB;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,eAAe,CAEhF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAKpF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAKxC"}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
26
26
|
*/
|
|
27
27
|
import { createFrameBudget, canRenderFrame, recordFrame, getElapsedMs, resetBudget, shouldSkipFrame, } from './frame-budget';
|
|
28
|
-
import { calculateScaledDimensions, applyScaledDimensions, } from './canvas-scaler';
|
|
28
|
+
import { calculateScaledDimensions, applyScaledDimensions, reapplyContextScale, } from './canvas-scaler';
|
|
29
29
|
import { createPreviewRuntime } from './preview-runtime';
|
|
30
30
|
let activePreviewRenderer = null;
|
|
31
31
|
class PreviewEngine {
|
|
@@ -46,6 +46,9 @@ class PreviewEngine {
|
|
|
46
46
|
initialize() {
|
|
47
47
|
const scaled = calculateScaledDimensions(this.config.width, this.config.height);
|
|
48
48
|
applyScaledDimensions(this.canvas, scaled);
|
|
49
|
+
// NOTE: Canvas resizing resets the 2D context transform.
|
|
50
|
+
// Reapply scale factor once after resize for correct rendering.
|
|
51
|
+
reapplyContextScale(this.canvas, scaled);
|
|
49
52
|
this.runtime = createPreviewRuntime(this.canvas, scaled.renderWidth, scaled.renderHeight, this.config.seed ?? 12345, this.config.vars ?? []);
|
|
50
53
|
const totalFrames = this.config.totalFrames ?? 120;
|
|
51
54
|
this.runtime.totalFrames = totalFrames;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/unified-renderer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAkB,cAAc,EAAoE,MAAM,UAAU,CAAC;AAmBhJ,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC;CACnB;AA6ED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,cAAmB,GAC3B,eAAe,
|
|
1
|
+
{"version":3,"file":"unified-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/unified-renderer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAkB,cAAc,EAAoE,MAAM,UAAU,CAAC;AAmBhJ,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC;CACnB;AA6ED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,cAAmB,GAC3B,eAAe,CA0PjB"}
|
|
@@ -7,7 +7,7 @@ import { compileBackgroundPreset, getPaletteColors } from '../presets/background
|
|
|
7
7
|
import { compilePrimitive } from '../presets/primitives';
|
|
8
8
|
import { wrapSketch, validateSketchSafety } from '../presets/sketch-wrapper';
|
|
9
9
|
import { createPreviewRuntime } from './preview-runtime';
|
|
10
|
-
import { calculateScaledDimensions, applyScaledDimensions } from './canvas-scaler';
|
|
10
|
+
import { calculateScaledDimensions, applyScaledDimensions, reapplyContextScale, clearCanvasIgnoringTransform } from './canvas-scaler';
|
|
11
11
|
import { createFrameBudget, canRenderFrame, recordFrame, resetBudget, shouldSkipFrame } from './frame-budget';
|
|
12
12
|
import { PREVIEW_BUDGET } from './preview-types';
|
|
13
13
|
function validateSketchElement(element) {
|
|
@@ -89,6 +89,9 @@ export function renderUnifiedSystem(system, canvas, options = {}) {
|
|
|
89
89
|
console.log(`[UIRenderer] Canvas scaled: ${system.width}x${system.height} → ${scaled.renderWidth}x${scaled.renderHeight}`);
|
|
90
90
|
}
|
|
91
91
|
applyScaledDimensions(canvas, scaled);
|
|
92
|
+
// NOTE: Canvas resizing resets the 2D context transform.
|
|
93
|
+
// Reapply scale factor once after resize for correct rendering.
|
|
94
|
+
reapplyContextScale(canvas, scaled);
|
|
92
95
|
const ctx = canvas.getContext('2d');
|
|
93
96
|
let animationId = null;
|
|
94
97
|
let isRunning = false;
|
|
@@ -279,7 +282,7 @@ export function renderUnifiedSystem(system, canvas, options = {}) {
|
|
|
279
282
|
const destroy = () => {
|
|
280
283
|
isDestroyed = true;
|
|
281
284
|
stop();
|
|
282
|
-
ctx
|
|
285
|
+
clearCanvasIgnoringTransform(ctx, canvas);
|
|
283
286
|
};
|
|
284
287
|
const renderer = {
|
|
285
288
|
render,
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.8.
|
|
2
|
+
* @nexart/ui-renderer v0.8.1 - Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Lightweight Preview Runtime for NexArt Protocol.
|
|
5
5
|
* This SDK is non-canonical and for preview only.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Max total time: 500ms
|
|
10
10
|
* - Max canvas dimension: 900px
|
|
11
11
|
*/
|
|
12
|
-
export declare const SDK_VERSION = "0.8.
|
|
12
|
+
export declare const SDK_VERSION = "0.8.1";
|
|
13
13
|
export declare const AESTHETIC_DEFAULTS: {
|
|
14
14
|
readonly background: {
|
|
15
15
|
readonly r: 246;
|
package/dist/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.8.
|
|
2
|
+
* @nexart/ui-renderer v0.8.1 - Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Lightweight Preview Runtime for NexArt Protocol.
|
|
5
5
|
* This SDK is non-canonical and for preview only.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Max total time: 500ms
|
|
10
10
|
* - Max canvas dimension: 900px
|
|
11
11
|
*/
|
|
12
|
-
export const SDK_VERSION = '0.8.
|
|
12
|
+
export const SDK_VERSION = '0.8.1';
|
|
13
13
|
export const AESTHETIC_DEFAULTS = {
|
|
14
14
|
background: { r: 246, g: 245, b: 242 },
|
|
15
15
|
foreground: { r: 45, g: 45, b: 45 },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexart/ui-renderer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Lightweight Preview Runtime for NexArt Protocol. Non-canonical, performance-optimized with budget limits (max 30 frames, 500ms, 900px canvas).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|