@pooder/kit 5.4.0 → 6.0.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.
Files changed (69) hide show
  1. package/.test-dist/src/coordinate.js +74 -0
  2. package/.test-dist/src/extensions/background.js +547 -0
  3. package/.test-dist/src/extensions/bridgeSelection.js +20 -0
  4. package/.test-dist/src/extensions/constraints.js +237 -0
  5. package/.test-dist/src/extensions/dieline.js +931 -0
  6. package/.test-dist/src/extensions/dielineShape.js +66 -0
  7. package/.test-dist/src/extensions/edgeScale.js +12 -0
  8. package/.test-dist/src/extensions/feature.js +910 -0
  9. package/.test-dist/src/extensions/featureComplete.js +32 -0
  10. package/.test-dist/src/extensions/film.js +226 -0
  11. package/.test-dist/src/extensions/geometry.js +609 -0
  12. package/.test-dist/src/extensions/image.js +1613 -0
  13. package/.test-dist/src/extensions/index.js +28 -0
  14. package/.test-dist/src/extensions/maskOps.js +334 -0
  15. package/.test-dist/src/extensions/mirror.js +104 -0
  16. package/.test-dist/src/extensions/ruler.js +442 -0
  17. package/.test-dist/src/extensions/sceneLayout.js +96 -0
  18. package/.test-dist/src/extensions/sceneLayoutModel.js +202 -0
  19. package/.test-dist/src/extensions/sceneVisibility.js +55 -0
  20. package/.test-dist/src/extensions/size.js +331 -0
  21. package/.test-dist/src/extensions/tracer.js +709 -0
  22. package/.test-dist/src/extensions/white-ink.js +1200 -0
  23. package/.test-dist/src/extensions/wrappedOffsets.js +33 -0
  24. package/.test-dist/src/index.js +18 -0
  25. package/.test-dist/src/services/CanvasService.js +1011 -0
  26. package/.test-dist/src/services/ViewportSystem.js +76 -0
  27. package/.test-dist/src/services/index.js +25 -0
  28. package/.test-dist/src/services/renderSpec.js +2 -0
  29. package/.test-dist/src/services/visibility.js +54 -0
  30. package/.test-dist/src/units.js +30 -0
  31. package/.test-dist/tests/run.js +148 -0
  32. package/CHANGELOG.md +6 -0
  33. package/dist/index.d.mts +150 -62
  34. package/dist/index.d.ts +150 -62
  35. package/dist/index.js +2219 -1714
  36. package/dist/index.mjs +2226 -1718
  37. package/package.json +1 -1
  38. package/src/coordinate.ts +106 -106
  39. package/src/extensions/background.ts +716 -323
  40. package/src/extensions/bridgeSelection.ts +17 -17
  41. package/src/extensions/constraints.ts +322 -322
  42. package/src/extensions/dieline.ts +1169 -1149
  43. package/src/extensions/dielineShape.ts +109 -109
  44. package/src/extensions/edgeScale.ts +19 -19
  45. package/src/extensions/feature.ts +1140 -1137
  46. package/src/extensions/featureComplete.ts +46 -46
  47. package/src/extensions/film.ts +270 -266
  48. package/src/extensions/geometry.ts +851 -885
  49. package/src/extensions/image.ts +2007 -2054
  50. package/src/extensions/index.ts +10 -11
  51. package/src/extensions/maskOps.ts +283 -283
  52. package/src/extensions/mirror.ts +128 -128
  53. package/src/extensions/ruler.ts +664 -654
  54. package/src/extensions/sceneLayout.ts +140 -140
  55. package/src/extensions/sceneLayoutModel.ts +364 -364
  56. package/src/extensions/size.ts +389 -389
  57. package/src/extensions/tracer.ts +1019 -1019
  58. package/src/extensions/white-ink.ts +1508 -1575
  59. package/src/extensions/wrappedOffsets.ts +33 -33
  60. package/src/index.ts +2 -2
  61. package/src/services/CanvasService.ts +1286 -832
  62. package/src/services/ViewportSystem.ts +95 -95
  63. package/src/services/index.ts +4 -3
  64. package/src/services/renderSpec.ts +83 -53
  65. package/src/services/visibility.ts +78 -0
  66. package/src/units.ts +27 -27
  67. package/tests/run.ts +253 -118
  68. package/tsconfig.test.json +15 -15
  69. package/src/extensions/sceneVisibility.ts +0 -64
@@ -1,46 +1,46 @@
1
- import { ConstraintContext, ConstraintFeature, ConstraintRegistry } from "./constraints";
2
-
3
- export type FeatureCompleteIssue = {
4
- featureId: string;
5
- groupId?: string;
6
- reason: string;
7
- };
8
-
9
- export function validateFeaturesStrict(
10
- features: ConstraintFeature[],
11
- context: ConstraintContext,
12
- ): { ok: boolean; issues?: FeatureCompleteIssue[] } {
13
- const eps = 1e-6;
14
- const issues: FeatureCompleteIssue[] = [];
15
-
16
- for (const f of features) {
17
- if (!f.constraints || f.constraints.length === 0) continue;
18
- // Pass ALL constraints (including validateOnly) for strict validation check
19
- const constrained = ConstraintRegistry.apply(f.x, f.y, f, context, f.constraints);
20
- if (
21
- Math.abs(constrained.x - f.x) > eps ||
22
- Math.abs(constrained.y - f.y) > eps
23
- ) {
24
- issues.push({
25
- featureId: f.id,
26
- groupId: f.groupId,
27
- reason: "Position violates constraint strategy",
28
- });
29
- }
30
- }
31
-
32
- return { ok: issues.length === 0, issues: issues.length ? issues : undefined };
33
- }
34
-
35
- export function completeFeaturesStrict(
36
- features: ConstraintFeature[],
37
- context: ConstraintContext,
38
- update: (nextFeatures: ConstraintFeature[]) => void,
39
- ): { ok: boolean; issues?: FeatureCompleteIssue[] } {
40
- const validation = validateFeaturesStrict(features, context);
41
- if (!validation.ok) return validation;
42
- const next = JSON.parse(JSON.stringify(features || [])) as ConstraintFeature[];
43
- update(next);
44
- return { ok: true };
45
- }
46
-
1
+ import { ConstraintContext, ConstraintFeature, ConstraintRegistry } from "./constraints";
2
+
3
+ export type FeatureCompleteIssue = {
4
+ featureId: string;
5
+ groupId?: string;
6
+ reason: string;
7
+ };
8
+
9
+ export function validateFeaturesStrict(
10
+ features: ConstraintFeature[],
11
+ context: ConstraintContext,
12
+ ): { ok: boolean; issues?: FeatureCompleteIssue[] } {
13
+ const eps = 1e-6;
14
+ const issues: FeatureCompleteIssue[] = [];
15
+
16
+ for (const f of features) {
17
+ if (!f.constraints || f.constraints.length === 0) continue;
18
+ // Pass ALL constraints (including validateOnly) for strict validation check
19
+ const constrained = ConstraintRegistry.apply(f.x, f.y, f, context, f.constraints);
20
+ if (
21
+ Math.abs(constrained.x - f.x) > eps ||
22
+ Math.abs(constrained.y - f.y) > eps
23
+ ) {
24
+ issues.push({
25
+ featureId: f.id,
26
+ groupId: f.groupId,
27
+ reason: "Position violates constraint strategy",
28
+ });
29
+ }
30
+ }
31
+
32
+ return { ok: issues.length === 0, issues: issues.length ? issues : undefined };
33
+ }
34
+
35
+ export function completeFeaturesStrict(
36
+ features: ConstraintFeature[],
37
+ context: ConstraintContext,
38
+ update: (nextFeatures: ConstraintFeature[]) => void,
39
+ ): { ok: boolean; issues?: FeatureCompleteIssue[] } {
40
+ const validation = validateFeaturesStrict(features, context);
41
+ if (!validation.ok) return validation;
42
+ const next = JSON.parse(JSON.stringify(features || [])) as ConstraintFeature[];
43
+ update(next);
44
+ return { ok: true };
45
+ }
46
+
@@ -1,266 +1,270 @@
1
- import {
2
- Extension,
3
- ExtensionContext,
4
- ContributionPointIds,
5
- CommandContribution,
6
- ConfigurationContribution,
7
- ConfigurationService,
8
- } from "@pooder/core";
9
- import { FabricImage } from "fabric";
10
- import { CanvasService, RenderObjectSpec } from "../services";
11
-
12
- interface SourceSize {
13
- width: number;
14
- height: number;
15
- }
16
-
17
- const FILM_LAYER_ID = "overlay";
18
- const FILM_IMAGE_ID = "film-image";
19
- const DEFAULT_WIDTH = 800;
20
- const DEFAULT_HEIGHT = 600;
21
-
22
- export class FilmTool implements Extension {
23
- id = "pooder.kit.film";
24
-
25
- public metadata = {
26
- name: "FilmTool",
27
- };
28
-
29
- private url: string = "";
30
- private opacity: number = 0.5;
31
-
32
- private canvasService?: CanvasService;
33
- private specs: RenderObjectSpec[] = [];
34
- private renderProducerDisposable?: { dispose: () => void };
35
- private renderSeq = 0;
36
- private renderImageUrl = "";
37
- private sourceSizeBySrc: Map<string, SourceSize> = new Map();
38
- private pendingSizeBySrc: Map<string, Promise<SourceSize | null>> = new Map();
39
- private onCanvasResized = () => {
40
- this.updateFilm();
41
- };
42
-
43
- constructor(
44
- options?: Partial<{
45
- url: string;
46
- opacity: number;
47
- }>,
48
- ) {
49
- if (options) {
50
- Object.assign(this, options);
51
- }
52
- }
53
-
54
- activate(context: ExtensionContext) {
55
- this.canvasService = context.services.get<CanvasService>("CanvasService");
56
- if (!this.canvasService) {
57
- console.warn("CanvasService not found for FilmTool");
58
- return;
59
- }
60
-
61
- this.renderProducerDisposable?.dispose();
62
- this.renderProducerDisposable = this.canvasService.registerRenderProducer(
63
- this.id,
64
- () => ({
65
- layerSpecs: {
66
- [FILM_LAYER_ID]: this.specs,
67
- },
68
- }),
69
- { priority: 500 },
70
- );
71
-
72
- const configService = context.services.get<ConfigurationService>(
73
- "ConfigurationService",
74
- );
75
- if (configService) {
76
- // Load initial config
77
- this.url = configService.get("film.url", this.url);
78
- this.opacity = configService.get("film.opacity", this.opacity);
79
-
80
- // Listen for changes
81
- configService.onAnyChange((e: { key: string; value: any }) => {
82
- if (e.key.startsWith("film.")) {
83
- const prop = e.key.split(".")[1];
84
- console.log(
85
- `[FilmTool] Config change detected: ${e.key} -> ${e.value}`,
86
- );
87
- if (prop && prop in this) {
88
- (this as any)[prop] = e.value;
89
- this.updateFilm();
90
- }
91
- }
92
- });
93
- }
94
-
95
- context.eventBus.on("canvas:resized", this.onCanvasResized);
96
- this.updateFilm();
97
- }
98
-
99
- deactivate(context: ExtensionContext) {
100
- context.eventBus.off("canvas:resized", this.onCanvasResized);
101
- this.renderSeq += 1;
102
- this.specs = [];
103
- this.renderImageUrl = "";
104
- this.renderProducerDisposable?.dispose();
105
- this.renderProducerDisposable = undefined;
106
- if (!this.canvasService) return;
107
- void this.canvasService.flushRenderFromProducers();
108
- this.canvasService.requestRenderAll();
109
- this.canvasService = undefined;
110
- }
111
-
112
- contribute() {
113
- return {
114
- [ContributionPointIds.CONFIGURATIONS]: [
115
- {
116
- id: "film.url",
117
- type: "string",
118
- label: "Film Image URL",
119
- default: "",
120
- },
121
- {
122
- id: "film.opacity",
123
- type: "number",
124
- label: "Opacity",
125
- min: 0,
126
- max: 1,
127
- step: 0.1,
128
- default: 0.5,
129
- },
130
- ] as ConfigurationContribution[],
131
- [ContributionPointIds.COMMANDS]: [
132
- {
133
- command: "setFilmImage",
134
- title: "Set Film Image",
135
- handler: (url: string, opacity: number) => {
136
- if (this.url === url && this.opacity === opacity) return true;
137
-
138
- this.url = url;
139
- this.opacity = opacity;
140
-
141
- this.updateFilm();
142
-
143
- return true;
144
- },
145
- },
146
- ] as CommandContribution[],
147
- };
148
- }
149
-
150
- private getViewportSize(): { width: number; height: number } {
151
- const width = Number(this.canvasService?.canvas.width || 0);
152
- const height = Number(this.canvasService?.canvas.height || 0);
153
- return {
154
- width: width > 0 ? width : DEFAULT_WIDTH,
155
- height: height > 0 ? height : DEFAULT_HEIGHT,
156
- };
157
- }
158
-
159
- private clampOpacity(value: number): number {
160
- return Math.max(0, Math.min(1, Number(value)));
161
- }
162
-
163
- private buildFilmSpecs(
164
- imageUrl: string,
165
- opacity: number,
166
- ): RenderObjectSpec[] {
167
- if (!imageUrl) {
168
- return [];
169
- }
170
- const { width, height } = this.getViewportSize();
171
- const sourceSize = this.sourceSizeBySrc.get(imageUrl);
172
- const sourceWidth = Math.max(1, Number(sourceSize?.width || width));
173
- const sourceHeight = Math.max(1, Number(sourceSize?.height || height));
174
- const coverScale = Math.max(width / sourceWidth, height / sourceHeight);
175
- return [
176
- {
177
- id: FILM_IMAGE_ID,
178
- type: "image",
179
- src: imageUrl,
180
- space: "screen",
181
- data: {
182
- id: FILM_IMAGE_ID,
183
- layerId: FILM_LAYER_ID,
184
- type: "film-image",
185
- },
186
- props: {
187
- left: 0,
188
- top: 0,
189
- originX: "left",
190
- originY: "top",
191
- opacity: this.clampOpacity(opacity),
192
- scaleX: coverScale,
193
- scaleY: coverScale,
194
- selectable: false,
195
- evented: false,
196
- excludeFromExport: true,
197
- },
198
- },
199
- ];
200
- }
201
-
202
- private async ensureImageSize(src: string): Promise<SourceSize | null> {
203
- if (!src) return null;
204
- const cached = this.sourceSizeBySrc.get(src);
205
- if (cached) return cached;
206
-
207
- const pending = this.pendingSizeBySrc.get(src);
208
- if (pending) {
209
- return pending;
210
- }
211
-
212
- const task = this.loadImageSize(src);
213
- this.pendingSizeBySrc.set(src, task);
214
- try {
215
- return await task;
216
- } finally {
217
- if (this.pendingSizeBySrc.get(src) === task) {
218
- this.pendingSizeBySrc.delete(src);
219
- }
220
- }
221
- }
222
-
223
- private async loadImageSize(src: string): Promise<SourceSize | null> {
224
- try {
225
- const image = await FabricImage.fromURL(src, {
226
- crossOrigin: "anonymous",
227
- });
228
- const width = Number(image?.width || 0);
229
- const height = Number(image?.height || 0);
230
- if (width > 0 && height > 0) {
231
- const size = { width, height };
232
- this.sourceSizeBySrc.set(src, size);
233
- return size;
234
- }
235
- } catch (error) {
236
- console.error("[FilmTool] Failed to load film image", src, error);
237
- }
238
- return null;
239
- }
240
-
241
- private updateFilm() {
242
- void this.updateFilmAsync();
243
- }
244
-
245
- private async updateFilmAsync() {
246
- if (!this.canvasService) return;
247
- const seq = ++this.renderSeq;
248
- const nextUrl = String(this.url || "").trim();
249
-
250
- if (!nextUrl) {
251
- this.renderImageUrl = "";
252
- } else if (nextUrl !== this.renderImageUrl) {
253
- const loaded = await this.ensureImageSize(nextUrl);
254
- if (seq !== this.renderSeq) return;
255
- if (loaded) {
256
- this.renderImageUrl = nextUrl;
257
- }
258
- }
259
-
260
- this.specs = this.buildFilmSpecs(this.renderImageUrl, this.opacity);
261
- await this.canvasService.flushRenderFromProducers();
262
- if (seq !== this.renderSeq) return;
263
- this.canvasService.bringLayerToFront(FILM_LAYER_ID);
264
- this.canvasService.requestRenderAll();
265
- }
266
- }
1
+ import {
2
+ Extension,
3
+ ExtensionContext,
4
+ ContributionPointIds,
5
+ CommandContribution,
6
+ ConfigurationContribution,
7
+ ConfigurationService,
8
+ } from "@pooder/core";
9
+ import { FabricImage } from "fabric";
10
+ import { CanvasService, RenderObjectSpec } from "../services";
11
+
12
+ interface SourceSize {
13
+ width: number;
14
+ height: number;
15
+ }
16
+
17
+ const FILM_LAYER_ID = "overlay";
18
+ const FILM_IMAGE_ID = "film-image";
19
+ const DEFAULT_WIDTH = 800;
20
+ const DEFAULT_HEIGHT = 600;
21
+
22
+ export class FilmTool implements Extension {
23
+ id = "pooder.kit.film";
24
+
25
+ public metadata = {
26
+ name: "FilmTool",
27
+ };
28
+
29
+ private url: string = "";
30
+ private opacity: number = 0.5;
31
+
32
+ private canvasService?: CanvasService;
33
+ private specs: RenderObjectSpec[] = [];
34
+ private renderProducerDisposable?: { dispose: () => void };
35
+ private renderSeq = 0;
36
+ private renderImageUrl = "";
37
+ private sourceSizeBySrc: Map<string, SourceSize> = new Map();
38
+ private pendingSizeBySrc: Map<string, Promise<SourceSize | null>> = new Map();
39
+ private onCanvasResized = () => {
40
+ this.updateFilm();
41
+ };
42
+
43
+ constructor(
44
+ options?: Partial<{
45
+ url: string;
46
+ opacity: number;
47
+ }>,
48
+ ) {
49
+ if (options) {
50
+ Object.assign(this, options);
51
+ }
52
+ }
53
+
54
+ activate(context: ExtensionContext) {
55
+ this.canvasService = context.services.get<CanvasService>("CanvasService");
56
+ if (!this.canvasService) {
57
+ console.warn("CanvasService not found for FilmTool");
58
+ return;
59
+ }
60
+
61
+ this.renderProducerDisposable?.dispose();
62
+ this.renderProducerDisposable = this.canvasService.registerRenderProducer(
63
+ this.id,
64
+ () => ({
65
+ passes: [
66
+ {
67
+ id: FILM_LAYER_ID,
68
+ stack: 1000,
69
+ order: 0,
70
+ objects: this.specs,
71
+ },
72
+ ],
73
+ }),
74
+ { priority: 500 },
75
+ );
76
+
77
+ const configService = context.services.get<ConfigurationService>(
78
+ "ConfigurationService",
79
+ );
80
+ if (configService) {
81
+ // Load initial config
82
+ this.url = configService.get("film.url", this.url);
83
+ this.opacity = configService.get("film.opacity", this.opacity);
84
+
85
+ // Listen for changes
86
+ configService.onAnyChange((e: { key: string; value: any }) => {
87
+ if (e.key.startsWith("film.")) {
88
+ const prop = e.key.split(".")[1];
89
+ console.log(
90
+ `[FilmTool] Config change detected: ${e.key} -> ${e.value}`,
91
+ );
92
+ if (prop && prop in this) {
93
+ (this as any)[prop] = e.value;
94
+ this.updateFilm();
95
+ }
96
+ }
97
+ });
98
+ }
99
+
100
+ context.eventBus.on("canvas:resized", this.onCanvasResized);
101
+ this.updateFilm();
102
+ }
103
+
104
+ deactivate(context: ExtensionContext) {
105
+ context.eventBus.off("canvas:resized", this.onCanvasResized);
106
+ this.renderSeq += 1;
107
+ this.specs = [];
108
+ this.renderImageUrl = "";
109
+ this.renderProducerDisposable?.dispose();
110
+ this.renderProducerDisposable = undefined;
111
+ if (!this.canvasService) return;
112
+ void this.canvasService.flushRenderFromProducers();
113
+ this.canvasService.requestRenderAll();
114
+ this.canvasService = undefined;
115
+ }
116
+
117
+ contribute() {
118
+ return {
119
+ [ContributionPointIds.CONFIGURATIONS]: [
120
+ {
121
+ id: "film.url",
122
+ type: "string",
123
+ label: "Film Image URL",
124
+ default: "",
125
+ },
126
+ {
127
+ id: "film.opacity",
128
+ type: "number",
129
+ label: "Opacity",
130
+ min: 0,
131
+ max: 1,
132
+ step: 0.1,
133
+ default: 0.5,
134
+ },
135
+ ] as ConfigurationContribution[],
136
+ [ContributionPointIds.COMMANDS]: [
137
+ {
138
+ command: "setFilmImage",
139
+ title: "Set Film Image",
140
+ handler: (url: string, opacity: number) => {
141
+ if (this.url === url && this.opacity === opacity) return true;
142
+
143
+ this.url = url;
144
+ this.opacity = opacity;
145
+
146
+ this.updateFilm();
147
+
148
+ return true;
149
+ },
150
+ },
151
+ ] as CommandContribution[],
152
+ };
153
+ }
154
+
155
+ private getViewportSize(): { width: number; height: number } {
156
+ const width = Number(this.canvasService?.canvas.width || 0);
157
+ const height = Number(this.canvasService?.canvas.height || 0);
158
+ return {
159
+ width: width > 0 ? width : DEFAULT_WIDTH,
160
+ height: height > 0 ? height : DEFAULT_HEIGHT,
161
+ };
162
+ }
163
+
164
+ private clampOpacity(value: number): number {
165
+ return Math.max(0, Math.min(1, Number(value)));
166
+ }
167
+
168
+ private buildFilmSpecs(
169
+ imageUrl: string,
170
+ opacity: number,
171
+ ): RenderObjectSpec[] {
172
+ if (!imageUrl) {
173
+ return [];
174
+ }
175
+ const { width, height } = this.getViewportSize();
176
+ const sourceSize = this.sourceSizeBySrc.get(imageUrl);
177
+ const sourceWidth = Math.max(1, Number(sourceSize?.width || width));
178
+ const sourceHeight = Math.max(1, Number(sourceSize?.height || height));
179
+ const coverScale = Math.max(width / sourceWidth, height / sourceHeight);
180
+ return [
181
+ {
182
+ id: FILM_IMAGE_ID,
183
+ type: "image",
184
+ src: imageUrl,
185
+ space: "screen",
186
+ data: {
187
+ id: FILM_IMAGE_ID,
188
+ layerId: FILM_LAYER_ID,
189
+ type: "film-image",
190
+ },
191
+ props: {
192
+ left: 0,
193
+ top: 0,
194
+ originX: "left",
195
+ originY: "top",
196
+ opacity: this.clampOpacity(opacity),
197
+ scaleX: coverScale,
198
+ scaleY: coverScale,
199
+ selectable: false,
200
+ evented: false,
201
+ excludeFromExport: true,
202
+ },
203
+ },
204
+ ];
205
+ }
206
+
207
+ private async ensureImageSize(src: string): Promise<SourceSize | null> {
208
+ if (!src) return null;
209
+ const cached = this.sourceSizeBySrc.get(src);
210
+ if (cached) return cached;
211
+
212
+ const pending = this.pendingSizeBySrc.get(src);
213
+ if (pending) {
214
+ return pending;
215
+ }
216
+
217
+ const task = this.loadImageSize(src);
218
+ this.pendingSizeBySrc.set(src, task);
219
+ try {
220
+ return await task;
221
+ } finally {
222
+ if (this.pendingSizeBySrc.get(src) === task) {
223
+ this.pendingSizeBySrc.delete(src);
224
+ }
225
+ }
226
+ }
227
+
228
+ private async loadImageSize(src: string): Promise<SourceSize | null> {
229
+ try {
230
+ const image = await FabricImage.fromURL(src, {
231
+ crossOrigin: "anonymous",
232
+ });
233
+ const width = Number(image?.width || 0);
234
+ const height = Number(image?.height || 0);
235
+ if (width > 0 && height > 0) {
236
+ const size = { width, height };
237
+ this.sourceSizeBySrc.set(src, size);
238
+ return size;
239
+ }
240
+ } catch (error) {
241
+ console.error("[FilmTool] Failed to load film image", src, error);
242
+ }
243
+ return null;
244
+ }
245
+
246
+ private updateFilm() {
247
+ void this.updateFilmAsync();
248
+ }
249
+
250
+ private async updateFilmAsync() {
251
+ if (!this.canvasService) return;
252
+ const seq = ++this.renderSeq;
253
+ const nextUrl = String(this.url || "").trim();
254
+
255
+ if (!nextUrl) {
256
+ this.renderImageUrl = "";
257
+ } else if (nextUrl !== this.renderImageUrl) {
258
+ const loaded = await this.ensureImageSize(nextUrl);
259
+ if (seq !== this.renderSeq) return;
260
+ if (loaded) {
261
+ this.renderImageUrl = nextUrl;
262
+ }
263
+ }
264
+
265
+ this.specs = this.buildFilmSpecs(this.renderImageUrl, this.opacity);
266
+ await this.canvasService.flushRenderFromProducers();
267
+ if (seq !== this.renderSeq) return;
268
+ this.canvasService.requestRenderAll();
269
+ }
270
+ }