@pooder/kit 5.3.0 → 5.3.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/.test-dist/src/CanvasService.js +249 -249
- package/.test-dist/src/ViewportSystem.js +75 -75
- package/.test-dist/src/background.js +203 -203
- package/.test-dist/src/bridgeSelection.js +20 -20
- package/.test-dist/src/constraints.js +237 -237
- package/.test-dist/src/dieline.js +818 -818
- package/.test-dist/src/edgeScale.js +12 -12
- package/.test-dist/src/feature.js +826 -826
- package/.test-dist/src/featureComplete.js +32 -32
- package/.test-dist/src/film.js +167 -167
- package/.test-dist/src/geometry.js +506 -506
- package/.test-dist/src/image.js +1250 -1250
- package/.test-dist/src/maskOps.js +270 -270
- package/.test-dist/src/mirror.js +104 -104
- package/.test-dist/src/renderSpec.js +2 -2
- package/.test-dist/src/ruler.js +343 -343
- package/.test-dist/src/sceneLayout.js +99 -99
- package/.test-dist/src/sceneLayoutModel.js +196 -196
- package/.test-dist/src/sceneView.js +40 -40
- package/.test-dist/src/sceneVisibility.js +42 -42
- package/.test-dist/src/size.js +332 -332
- package/.test-dist/src/tracer.js +544 -544
- package/.test-dist/src/white-ink.js +829 -829
- package/.test-dist/src/wrappedOffsets.js +33 -33
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +108 -20
- package/dist/index.mjs +108 -20
- package/package.json +1 -1
- package/src/coordinate.ts +106 -106
- package/src/extensions/background.ts +230 -230
- package/src/extensions/bridgeSelection.ts +17 -17
- package/src/extensions/constraints.ts +322 -322
- package/src/extensions/dieline.ts +46 -0
- package/src/extensions/edgeScale.ts +19 -19
- package/src/extensions/feature.ts +1021 -1021
- package/src/extensions/featureComplete.ts +46 -46
- package/src/extensions/film.ts +194 -194
- package/src/extensions/geometry.ts +752 -719
- package/src/extensions/image.ts +1926 -1924
- package/src/extensions/index.ts +11 -11
- package/src/extensions/maskOps.ts +283 -283
- package/src/extensions/mirror.ts +128 -128
- package/src/extensions/ruler.ts +451 -451
- package/src/extensions/sceneLayout.ts +140 -140
- package/src/extensions/sceneLayoutModel.ts +352 -342
- package/src/extensions/sceneVisibility.ts +71 -71
- package/src/extensions/size.ts +389 -389
- package/src/extensions/tracer.ts +58 -19
- package/src/extensions/white-ink.ts +1400 -1400
- package/src/extensions/wrappedOffsets.ts +33 -33
- package/src/index.ts +2 -2
- package/src/services/CanvasService.ts +300 -300
- package/src/services/ViewportSystem.ts +95 -95
- package/src/services/index.ts +3 -3
- package/src/services/renderSpec.ts +18 -18
- package/src/units.ts +27 -27
- package/tests/run.ts +118 -118
- package/tsconfig.test.json +15 -15
|
@@ -37,6 +37,8 @@ export interface DielineGeometry {
|
|
|
37
37
|
scale?: number;
|
|
38
38
|
strokeWidth?: number;
|
|
39
39
|
pathData?: string;
|
|
40
|
+
customSourceWidthPx?: number;
|
|
41
|
+
customSourceHeightPx?: number;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export interface LineStyle {
|
|
@@ -61,6 +63,8 @@ export interface DielineState {
|
|
|
61
63
|
showBleedLines: boolean;
|
|
62
64
|
features: DielineFeature[];
|
|
63
65
|
pathData?: string;
|
|
66
|
+
customSourceWidthPx?: number;
|
|
67
|
+
customSourceHeightPx?: number;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
const IMAGE_OBJECT_LAYER_ID = "image.user";
|
|
@@ -193,6 +197,20 @@ export class DielineTool implements Extension {
|
|
|
193
197
|
);
|
|
194
198
|
s.features = configService.get("dieline.features", s.features);
|
|
195
199
|
s.pathData = configService.get("dieline.pathData", s.pathData);
|
|
200
|
+
const sourceWidth = Number(
|
|
201
|
+
configService.get("dieline.customSourceWidthPx", 0),
|
|
202
|
+
);
|
|
203
|
+
const sourceHeight = Number(
|
|
204
|
+
configService.get("dieline.customSourceHeightPx", 0),
|
|
205
|
+
);
|
|
206
|
+
s.customSourceWidthPx =
|
|
207
|
+
Number.isFinite(sourceWidth) && sourceWidth > 0
|
|
208
|
+
? sourceWidth
|
|
209
|
+
: undefined;
|
|
210
|
+
s.customSourceHeightPx =
|
|
211
|
+
Number.isFinite(sourceHeight) && sourceHeight > 0
|
|
212
|
+
? sourceHeight
|
|
213
|
+
: undefined;
|
|
196
214
|
|
|
197
215
|
// Listen for changes
|
|
198
216
|
configService.onAnyChange((e: { key: string; value: any }) => {
|
|
@@ -262,6 +280,18 @@ export class DielineTool implements Extension {
|
|
|
262
280
|
case "dieline.pathData":
|
|
263
281
|
s.pathData = e.value;
|
|
264
282
|
break;
|
|
283
|
+
case "dieline.customSourceWidthPx":
|
|
284
|
+
s.customSourceWidthPx =
|
|
285
|
+
Number.isFinite(Number(e.value)) && Number(e.value) > 0
|
|
286
|
+
? Number(e.value)
|
|
287
|
+
: undefined;
|
|
288
|
+
break;
|
|
289
|
+
case "dieline.customSourceHeightPx":
|
|
290
|
+
s.customSourceHeightPx =
|
|
291
|
+
Number.isFinite(Number(e.value)) && Number(e.value) > 0
|
|
292
|
+
? Number(e.value)
|
|
293
|
+
: undefined;
|
|
294
|
+
break;
|
|
265
295
|
}
|
|
266
296
|
this.updateDieline();
|
|
267
297
|
}
|
|
@@ -656,6 +686,8 @@ export class DielineTool implements Extension {
|
|
|
656
686
|
y: cy,
|
|
657
687
|
features: cutFeatures,
|
|
658
688
|
pathData: this.state.pathData,
|
|
689
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
690
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
659
691
|
});
|
|
660
692
|
const mask = new Path(maskPathData, {
|
|
661
693
|
fill: outsideColor,
|
|
@@ -683,6 +715,8 @@ export class DielineTool implements Extension {
|
|
|
683
715
|
y: cy,
|
|
684
716
|
features: cutFeatures,
|
|
685
717
|
pathData: this.state.pathData,
|
|
718
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
719
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
686
720
|
canvasWidth: canvasW,
|
|
687
721
|
canvasHeight: canvasH,
|
|
688
722
|
});
|
|
@@ -709,6 +743,8 @@ export class DielineTool implements Extension {
|
|
|
709
743
|
y: cy,
|
|
710
744
|
features: cutFeatures,
|
|
711
745
|
pathData: this.state.pathData,
|
|
746
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
747
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
712
748
|
canvasWidth: canvasW,
|
|
713
749
|
canvasHeight: canvasH,
|
|
714
750
|
},
|
|
@@ -721,6 +757,8 @@ export class DielineTool implements Extension {
|
|
|
721
757
|
y: cy,
|
|
722
758
|
features: cutFeatures,
|
|
723
759
|
pathData: this.state.pathData,
|
|
760
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
761
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
724
762
|
canvasWidth: canvasW,
|
|
725
763
|
canvasHeight: canvasH,
|
|
726
764
|
},
|
|
@@ -752,6 +790,8 @@ export class DielineTool implements Extension {
|
|
|
752
790
|
y: cy,
|
|
753
791
|
features: cutFeatures,
|
|
754
792
|
pathData: this.state.pathData,
|
|
793
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
794
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
755
795
|
canvasWidth: canvasW,
|
|
756
796
|
canvasHeight: canvasH,
|
|
757
797
|
});
|
|
@@ -781,6 +821,8 @@ export class DielineTool implements Extension {
|
|
|
781
821
|
y: cy,
|
|
782
822
|
features: absoluteFeatures,
|
|
783
823
|
pathData: this.state.pathData,
|
|
824
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
825
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
784
826
|
canvasWidth: canvasW,
|
|
785
827
|
canvasHeight: canvasH,
|
|
786
828
|
});
|
|
@@ -838,6 +880,8 @@ export class DielineTool implements Extension {
|
|
|
838
880
|
...sceneGeometry,
|
|
839
881
|
strokeWidth: this.state.mainLine.width,
|
|
840
882
|
pathData: this.state.pathData,
|
|
883
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
884
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
841
885
|
} as DielineGeometry;
|
|
842
886
|
}
|
|
843
887
|
|
|
@@ -904,6 +948,8 @@ export class DielineTool implements Extension {
|
|
|
904
948
|
y: cy,
|
|
905
949
|
features: cutFeatures,
|
|
906
950
|
pathData,
|
|
951
|
+
customSourceWidthPx: this.state.customSourceWidthPx,
|
|
952
|
+
customSourceHeightPx: this.state.customSourceHeightPx,
|
|
907
953
|
canvasWidth: canvasW,
|
|
908
954
|
canvasHeight: canvasH,
|
|
909
955
|
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export interface BoundsLike {
|
|
2
|
-
width: number;
|
|
3
|
-
height: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function computeDetectEdgeSize(
|
|
7
|
-
currentMax: number,
|
|
8
|
-
baseBounds: BoundsLike,
|
|
9
|
-
expandedBounds: BoundsLike,
|
|
10
|
-
): { width: number; height: number; scale: number } {
|
|
11
|
-
const baseMax = Math.max(baseBounds.width, baseBounds.height);
|
|
12
|
-
const scale = baseMax > 0 ? currentMax / baseMax : 1;
|
|
13
|
-
return {
|
|
14
|
-
scale,
|
|
15
|
-
width: expandedBounds.width * scale,
|
|
16
|
-
height: expandedBounds.height * scale,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
1
|
+
export interface BoundsLike {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function computeDetectEdgeSize(
|
|
7
|
+
currentMax: number,
|
|
8
|
+
baseBounds: BoundsLike,
|
|
9
|
+
expandedBounds: BoundsLike,
|
|
10
|
+
): { width: number; height: number; scale: number } {
|
|
11
|
+
const baseMax = Math.max(baseBounds.width, baseBounds.height);
|
|
12
|
+
const scale = baseMax > 0 ? currentMax / baseMax : 1;
|
|
13
|
+
return {
|
|
14
|
+
scale,
|
|
15
|
+
width: expandedBounds.width * scale,
|
|
16
|
+
height: expandedBounds.height * scale,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|