@pooder/kit 5.3.0 → 5.4.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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +249 -36
- package/dist/index.d.ts +249 -36
- package/dist/index.js +2374 -1049
- package/dist/index.mjs +2375 -1050
- package/package.json +1 -1
- package/src/extensions/background.ts +178 -85
- package/src/extensions/dieline.ts +1149 -1030
- package/src/extensions/dielineShape.ts +109 -0
- package/src/extensions/feature.ts +482 -366
- package/src/extensions/film.ts +148 -76
- package/src/extensions/geometry.ts +210 -44
- package/src/extensions/image.ts +244 -114
- package/src/extensions/ruler.ts +471 -268
- package/src/extensions/sceneLayoutModel.ts +28 -6
- package/src/extensions/sceneVisibility.ts +3 -10
- package/src/extensions/tracer.ts +1019 -980
- package/src/extensions/white-ink.ts +284 -231
- package/src/services/CanvasService.ts +543 -11
- package/src/services/renderSpec.ts +37 -2
- package/.test-dist/src/CanvasService.js +0 -249
- package/.test-dist/src/ViewportSystem.js +0 -75
- package/.test-dist/src/background.js +0 -203
- package/.test-dist/src/bridgeSelection.js +0 -20
- package/.test-dist/src/constraints.js +0 -237
- package/.test-dist/src/coordinate.js +0 -74
- package/.test-dist/src/dieline.js +0 -818
- package/.test-dist/src/edgeScale.js +0 -12
- package/.test-dist/src/extensions/background.js +0 -203
- package/.test-dist/src/extensions/bridgeSelection.js +0 -20
- package/.test-dist/src/extensions/constraints.js +0 -237
- package/.test-dist/src/extensions/dieline.js +0 -828
- package/.test-dist/src/extensions/edgeScale.js +0 -12
- package/.test-dist/src/extensions/feature.js +0 -825
- package/.test-dist/src/extensions/featureComplete.js +0 -32
- package/.test-dist/src/extensions/film.js +0 -167
- package/.test-dist/src/extensions/geometry.js +0 -545
- package/.test-dist/src/extensions/image.js +0 -1529
- package/.test-dist/src/extensions/index.js +0 -30
- package/.test-dist/src/extensions/maskOps.js +0 -279
- package/.test-dist/src/extensions/mirror.js +0 -104
- package/.test-dist/src/extensions/ruler.js +0 -345
- package/.test-dist/src/extensions/sceneLayout.js +0 -96
- package/.test-dist/src/extensions/sceneLayoutModel.js +0 -196
- package/.test-dist/src/extensions/sceneVisibility.js +0 -62
- package/.test-dist/src/extensions/size.js +0 -331
- package/.test-dist/src/extensions/tracer.js +0 -538
- package/.test-dist/src/extensions/white-ink.js +0 -1190
- package/.test-dist/src/extensions/wrappedOffsets.js +0 -33
- package/.test-dist/src/feature.js +0 -826
- package/.test-dist/src/featureComplete.js +0 -32
- package/.test-dist/src/film.js +0 -167
- package/.test-dist/src/geometry.js +0 -506
- package/.test-dist/src/image.js +0 -1250
- package/.test-dist/src/index.js +0 -18
- package/.test-dist/src/maskOps.js +0 -270
- package/.test-dist/src/mirror.js +0 -104
- package/.test-dist/src/renderSpec.js +0 -2
- package/.test-dist/src/ruler.js +0 -343
- package/.test-dist/src/sceneLayout.js +0 -99
- package/.test-dist/src/sceneLayoutModel.js +0 -196
- package/.test-dist/src/sceneView.js +0 -40
- package/.test-dist/src/sceneVisibility.js +0 -42
- package/.test-dist/src/services/CanvasService.js +0 -249
- package/.test-dist/src/services/ViewportSystem.js +0 -76
- package/.test-dist/src/services/index.js +0 -24
- package/.test-dist/src/services/renderSpec.js +0 -2
- package/.test-dist/src/size.js +0 -332
- package/.test-dist/src/tracer.js +0 -544
- package/.test-dist/src/units.js +0 -30
- package/.test-dist/src/white-ink.js +0 -829
- package/.test-dist/src/wrappedOffsets.js +0 -33
- package/.test-dist/tests/run.js +0 -94
|
@@ -2,6 +2,13 @@ import type { ConfigurationService } from "@pooder/core";
|
|
|
2
2
|
import type { CanvasService } from "../services";
|
|
3
3
|
import { Coordinate, Unit } from "../coordinate";
|
|
4
4
|
import { parseLengthToMm } from "../units";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_DIELINE_SHAPE,
|
|
7
|
+
DEFAULT_DIELINE_SHAPE_STYLE,
|
|
8
|
+
normalizeShapeStyle,
|
|
9
|
+
normalizeDielineShape,
|
|
10
|
+
} from "./dielineShape";
|
|
11
|
+
import type { DielineShape, DielineShapeStyle } from "./dielineShape";
|
|
5
12
|
|
|
6
13
|
export type SizeConstraintMode = "free" | "lockAspect" | "equal";
|
|
7
14
|
export type CutMode = "trim" | "outset" | "inset";
|
|
@@ -45,9 +52,9 @@ export interface SceneLayoutSnapshot {
|
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
export interface SceneGeometrySnapshot {
|
|
48
|
-
shape:
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
shape: DielineShape;
|
|
56
|
+
shapeStyle: DielineShapeStyle;
|
|
57
|
+
unit: "px";
|
|
51
58
|
x: number;
|
|
52
59
|
y: number;
|
|
53
60
|
width: number;
|
|
@@ -56,6 +63,8 @@ export interface SceneGeometrySnapshot {
|
|
|
56
63
|
offset: number;
|
|
57
64
|
scale: number;
|
|
58
65
|
pathData?: string;
|
|
66
|
+
customSourceWidthPx?: number;
|
|
67
|
+
customSourceHeightPx?: number;
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
const DEFAULT_SIZE_STATE: SizeState = {
|
|
@@ -325,11 +334,20 @@ export function buildSceneGeometry(
|
|
|
325
334
|
"mm",
|
|
326
335
|
);
|
|
327
336
|
const offset = (layout.cutRect.width - layout.trimRect.width) / 2;
|
|
337
|
+
const sourceWidth = Number(configService.get("dieline.customSourceWidthPx", 0));
|
|
338
|
+
const sourceHeight = Number(
|
|
339
|
+
configService.get("dieline.customSourceHeightPx", 0),
|
|
340
|
+
);
|
|
341
|
+
const shapeStyle = normalizeShapeStyle(
|
|
342
|
+
configService.get("dieline.shapeStyle", DEFAULT_DIELINE_SHAPE_STYLE),
|
|
343
|
+
);
|
|
328
344
|
|
|
329
345
|
return {
|
|
330
|
-
shape:
|
|
331
|
-
|
|
332
|
-
|
|
346
|
+
shape: normalizeDielineShape(
|
|
347
|
+
configService.get("dieline.shape", DEFAULT_DIELINE_SHAPE),
|
|
348
|
+
),
|
|
349
|
+
shapeStyle,
|
|
350
|
+
unit: "px",
|
|
333
351
|
x: layout.trimRect.centerX,
|
|
334
352
|
y: layout.trimRect.centerY,
|
|
335
353
|
width: layout.trimRect.width,
|
|
@@ -338,5 +356,9 @@ export function buildSceneGeometry(
|
|
|
338
356
|
offset,
|
|
339
357
|
scale: layout.scale,
|
|
340
358
|
pathData: configService.get("dieline.pathData"),
|
|
359
|
+
customSourceWidthPx:
|
|
360
|
+
Number.isFinite(sourceWidth) && sourceWidth > 0 ? sourceWidth : undefined,
|
|
361
|
+
customSourceHeightPx:
|
|
362
|
+
Number.isFinite(sourceHeight) && sourceHeight > 0 ? sourceHeight : undefined,
|
|
341
363
|
};
|
|
342
364
|
}
|
|
@@ -53,18 +53,11 @@ export class SceneVisibilityService implements Service {
|
|
|
53
53
|
const dielineLayer = this.canvasService.getLayer("dieline-overlay");
|
|
54
54
|
if (dielineLayer) {
|
|
55
55
|
const visible = !HIDDEN_DIELINE_TOOLS.has(this.activeToolId || "");
|
|
56
|
-
|
|
57
|
-
dielineLayer.set({ visible });
|
|
58
|
-
}
|
|
56
|
+
this.canvasService.setLayerVisibility("dieline-overlay", visible);
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const visible = !HIDDEN_RULER_TOOLS.has(this.activeToolId || "");
|
|
64
|
-
if (rulerLayer.visible !== visible) {
|
|
65
|
-
rulerLayer.set({ visible });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
59
|
+
const rulerVisible = !HIDDEN_RULER_TOOLS.has(this.activeToolId || "");
|
|
60
|
+
this.canvasService.setLayerVisibility("ruler-overlay", rulerVisible);
|
|
68
61
|
|
|
69
62
|
this.canvasService.requestRenderAll();
|
|
70
63
|
}
|