@pooder/kit 6.2.0 → 6.2.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.
- package/.test-dist/src/extensions/dieline/DielineTool.js +22 -9
- package/.test-dist/src/extensions/dieline/renderBuilder.js +47 -14
- package/.test-dist/src/extensions/feature/FeatureTool.js +20 -3
- package/.test-dist/src/extensions/featureCoordinates.js +21 -0
- package/.test-dist/src/extensions/featurePlacement.js +46 -0
- package/.test-dist/src/extensions/image/ImageTool.js +46 -348
- package/.test-dist/src/extensions/image/sessionOverlay.js +148 -0
- package/.test-dist/src/extensions/ruler/RulerTool.js +25 -2
- package/.test-dist/tests/run.js +25 -0
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +1506 -1494
- package/dist/index.mjs +1506 -1494
- package/package.json +1 -1
- package/src/extensions/dieline/DielineTool.ts +29 -9
- package/src/extensions/dieline/renderBuilder.ts +65 -17
- package/src/extensions/feature/FeatureTool.ts +23 -3
- package/src/extensions/featureCoordinates.ts +35 -0
- package/src/extensions/featurePlacement.ts +118 -0
- package/src/extensions/image/ImageTool.ts +57 -412
- package/src/extensions/image/sessionOverlay.ts +206 -0
- package/src/extensions/ruler/RulerTool.ts +24 -2
- package/tests/run.ts +37 -0
|
@@ -8,11 +8,12 @@ const EXTENSION_LINE_LENGTH = 5;
|
|
|
8
8
|
const MIN_ARROW_SIZE = 4;
|
|
9
9
|
const THICKNESS_TO_STROKE_WIDTH_RATIO = 20;
|
|
10
10
|
const DEFAULT_THICKNESS = 20;
|
|
11
|
-
const DEFAULT_GAP =
|
|
11
|
+
const DEFAULT_GAP = 65;
|
|
12
12
|
const DEFAULT_FONT_SIZE = 10;
|
|
13
13
|
const DEFAULT_BACKGROUND_COLOR = "#f0f0f0";
|
|
14
14
|
const DEFAULT_TEXT_COLOR = "#333333";
|
|
15
15
|
const DEFAULT_LINE_COLOR = "#999999";
|
|
16
|
+
const RULER_DEBUG_KEY = "ruler.debug";
|
|
16
17
|
const RULER_THICKNESS_MIN = 10;
|
|
17
18
|
const RULER_THICKNESS_MAX = 100;
|
|
18
19
|
const RULER_GAP_MIN = 0;
|
|
@@ -31,6 +32,7 @@ class RulerTool {
|
|
|
31
32
|
this.textColor = DEFAULT_TEXT_COLOR;
|
|
32
33
|
this.lineColor = DEFAULT_LINE_COLOR;
|
|
33
34
|
this.fontSize = DEFAULT_FONT_SIZE;
|
|
35
|
+
this.debugEnabled = false;
|
|
34
36
|
this.renderSeq = 0;
|
|
35
37
|
this.numericProps = new Set(["thickness", "gap", "fontSize"]);
|
|
36
38
|
this.specs = [];
|
|
@@ -72,7 +74,15 @@ class RulerTool {
|
|
|
72
74
|
this.syncConfig(configService);
|
|
73
75
|
configService.onAnyChange((e) => {
|
|
74
76
|
let shouldUpdate = false;
|
|
75
|
-
if (e.key
|
|
77
|
+
if (e.key === RULER_DEBUG_KEY) {
|
|
78
|
+
this.debugEnabled = e.value === true;
|
|
79
|
+
this.log("config:update", {
|
|
80
|
+
key: e.key,
|
|
81
|
+
raw: e.value,
|
|
82
|
+
normalized: this.debugEnabled,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else if (e.key.startsWith("ruler.")) {
|
|
76
86
|
const prop = e.key.split(".")[1];
|
|
77
87
|
if (prop && prop in this) {
|
|
78
88
|
if (this.numericProps.has(prop)) {
|
|
@@ -158,6 +168,12 @@ class RulerTool {
|
|
|
158
168
|
max: RULER_FONT_SIZE_MAX,
|
|
159
169
|
default: DEFAULT_FONT_SIZE,
|
|
160
170
|
},
|
|
171
|
+
{
|
|
172
|
+
id: RULER_DEBUG_KEY,
|
|
173
|
+
type: "boolean",
|
|
174
|
+
label: "Ruler Debug Log",
|
|
175
|
+
default: false,
|
|
176
|
+
},
|
|
161
177
|
],
|
|
162
178
|
[core_1.ContributionPointIds.COMMANDS]: [
|
|
163
179
|
{
|
|
@@ -187,7 +203,12 @@ class RulerTool {
|
|
|
187
203
|
],
|
|
188
204
|
};
|
|
189
205
|
}
|
|
206
|
+
isDebugEnabled() {
|
|
207
|
+
return this.debugEnabled;
|
|
208
|
+
}
|
|
190
209
|
log(step, payload) {
|
|
210
|
+
if (!this.isDebugEnabled())
|
|
211
|
+
return;
|
|
191
212
|
if (payload) {
|
|
192
213
|
console.debug(`[RulerTool] ${step}`, payload);
|
|
193
214
|
return;
|
|
@@ -201,6 +222,8 @@ class RulerTool {
|
|
|
201
222
|
this.textColor = configService.get("ruler.textColor", this.textColor);
|
|
202
223
|
this.lineColor = configService.get("ruler.lineColor", this.lineColor);
|
|
203
224
|
this.fontSize = this.toFiniteNumber(configService.get("ruler.fontSize", this.fontSize), DEFAULT_FONT_SIZE);
|
|
225
|
+
this.debugEnabled =
|
|
226
|
+
configService.get(RULER_DEBUG_KEY, this.debugEnabled) === true;
|
|
204
227
|
this.log("config:loaded", {
|
|
205
228
|
thickness: this.thickness,
|
|
206
229
|
gap: this.gap,
|
package/.test-dist/tests/run.js
CHANGED
|
@@ -11,6 +11,7 @@ const commands_2 = require("../src/extensions/white-ink/commands");
|
|
|
11
11
|
const config_2 = require("../src/extensions/white-ink/config");
|
|
12
12
|
const commands_3 = require("../src/extensions/dieline/commands");
|
|
13
13
|
const config_3 = require("../src/extensions/dieline/config");
|
|
14
|
+
const featureCoordinates_1 = require("../src/extensions/featureCoordinates");
|
|
14
15
|
function assert(condition, message) {
|
|
15
16
|
if (!condition)
|
|
16
17
|
throw new Error(message);
|
|
@@ -91,6 +92,29 @@ function testEdgeScale() {
|
|
|
91
92
|
assert(width === 140, `expected width 140, got ${width}`);
|
|
92
93
|
assert(height === 80, `expected height 80, got ${height}`);
|
|
93
94
|
}
|
|
95
|
+
function testFeaturePlacementProjection() {
|
|
96
|
+
const trimGeometry = {
|
|
97
|
+
x: 100,
|
|
98
|
+
y: 120,
|
|
99
|
+
width: 120,
|
|
100
|
+
height: 180,
|
|
101
|
+
};
|
|
102
|
+
const cutGeometry = {
|
|
103
|
+
x: 100,
|
|
104
|
+
y: 120,
|
|
105
|
+
width: 150,
|
|
106
|
+
height: 210,
|
|
107
|
+
};
|
|
108
|
+
const trimFeature = {
|
|
109
|
+
x: 0.82,
|
|
110
|
+
y: 0.68,
|
|
111
|
+
};
|
|
112
|
+
const trimCenter = (0, featureCoordinates_1.resolveFeaturePosition)(trimFeature, trimGeometry);
|
|
113
|
+
const cutFeature = (0, featureCoordinates_1.normalizePointInGeometry)(trimCenter, cutGeometry);
|
|
114
|
+
const cutCenter = (0, featureCoordinates_1.resolveFeaturePosition)(cutFeature, cutGeometry);
|
|
115
|
+
assert(Math.abs(trimCenter.x - cutCenter.x) < 1e-6, `expected projected feature x to stay fixed, got ${trimCenter.x} vs ${cutCenter.x}`);
|
|
116
|
+
assert(Math.abs(trimCenter.y - cutCenter.y) < 1e-6, `expected projected feature y to stay fixed, got ${trimCenter.y} vs ${cutCenter.y}`);
|
|
117
|
+
}
|
|
94
118
|
function testVisibilityDsl() {
|
|
95
119
|
const layers = new Map([
|
|
96
120
|
["ruler-overlay", { exists: true, objectCount: 2 }],
|
|
@@ -259,6 +283,7 @@ function main() {
|
|
|
259
283
|
testBridgeSelection();
|
|
260
284
|
testMaskOps();
|
|
261
285
|
testEdgeScale();
|
|
286
|
+
testFeaturePlacementProjection();
|
|
262
287
|
testVisibilityDsl();
|
|
263
288
|
testContributionCompatibility();
|
|
264
289
|
console.log("ok");
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -137,6 +137,7 @@ declare class ImageTool implements Extension {
|
|
|
137
137
|
private computeMoveSnapMatches;
|
|
138
138
|
private areSnapMatchesEqual;
|
|
139
139
|
private updateSnapMatchState;
|
|
140
|
+
private clearSnapGuideContext;
|
|
140
141
|
private clearSnapPreview;
|
|
141
142
|
private endMoveSnapInteraction;
|
|
142
143
|
private applyMoveSnapToTarget;
|
|
@@ -187,7 +188,6 @@ declare class ImageTool implements Extension {
|
|
|
187
188
|
private updateConfig;
|
|
188
189
|
private getFrameRect;
|
|
189
190
|
private getFrameRectScreen;
|
|
190
|
-
private toLayoutSceneRect;
|
|
191
191
|
private resolveDefaultFitArea;
|
|
192
192
|
private fitImageToDefaultArea;
|
|
193
193
|
private getImageObjects;
|
|
@@ -201,11 +201,8 @@ declare class ImageTool implements Extension {
|
|
|
201
201
|
private loadImageSize;
|
|
202
202
|
private getCoverScale;
|
|
203
203
|
private getFrameVisualConfig;
|
|
204
|
-
private
|
|
205
|
-
private resolveSceneGeometryForOverlay;
|
|
206
|
-
private resolveCutShapeRadius;
|
|
204
|
+
private resolveSessionOverlayState;
|
|
207
205
|
private getCropShapeHatchPattern;
|
|
208
|
-
private buildCropShapeOverlaySpecs;
|
|
209
206
|
private resolveRenderImageState;
|
|
210
207
|
private computeCanvasProps;
|
|
211
208
|
private toSceneObjectScale;
|
|
@@ -907,6 +904,7 @@ declare class RulerTool implements Extension {
|
|
|
907
904
|
private textColor;
|
|
908
905
|
private lineColor;
|
|
909
906
|
private fontSize;
|
|
907
|
+
private debugEnabled;
|
|
910
908
|
private renderSeq;
|
|
911
909
|
private readonly numericProps;
|
|
912
910
|
private specs;
|
|
@@ -928,6 +926,7 @@ declare class RulerTool implements Extension {
|
|
|
928
926
|
[ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
|
|
929
927
|
[ContributionPointIds.COMMANDS]: CommandContribution[];
|
|
930
928
|
};
|
|
929
|
+
private isDebugEnabled;
|
|
931
930
|
private log;
|
|
932
931
|
private syncConfig;
|
|
933
932
|
private toFiniteNumber;
|
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ declare class ImageTool implements Extension {
|
|
|
137
137
|
private computeMoveSnapMatches;
|
|
138
138
|
private areSnapMatchesEqual;
|
|
139
139
|
private updateSnapMatchState;
|
|
140
|
+
private clearSnapGuideContext;
|
|
140
141
|
private clearSnapPreview;
|
|
141
142
|
private endMoveSnapInteraction;
|
|
142
143
|
private applyMoveSnapToTarget;
|
|
@@ -187,7 +188,6 @@ declare class ImageTool implements Extension {
|
|
|
187
188
|
private updateConfig;
|
|
188
189
|
private getFrameRect;
|
|
189
190
|
private getFrameRectScreen;
|
|
190
|
-
private toLayoutSceneRect;
|
|
191
191
|
private resolveDefaultFitArea;
|
|
192
192
|
private fitImageToDefaultArea;
|
|
193
193
|
private getImageObjects;
|
|
@@ -201,11 +201,8 @@ declare class ImageTool implements Extension {
|
|
|
201
201
|
private loadImageSize;
|
|
202
202
|
private getCoverScale;
|
|
203
203
|
private getFrameVisualConfig;
|
|
204
|
-
private
|
|
205
|
-
private resolveSceneGeometryForOverlay;
|
|
206
|
-
private resolveCutShapeRadius;
|
|
204
|
+
private resolveSessionOverlayState;
|
|
207
205
|
private getCropShapeHatchPattern;
|
|
208
|
-
private buildCropShapeOverlaySpecs;
|
|
209
206
|
private resolveRenderImageState;
|
|
210
207
|
private computeCanvasProps;
|
|
211
208
|
private toSceneObjectScale;
|
|
@@ -907,6 +904,7 @@ declare class RulerTool implements Extension {
|
|
|
907
904
|
private textColor;
|
|
908
905
|
private lineColor;
|
|
909
906
|
private fontSize;
|
|
907
|
+
private debugEnabled;
|
|
910
908
|
private renderSeq;
|
|
911
909
|
private readonly numericProps;
|
|
912
910
|
private specs;
|
|
@@ -928,6 +926,7 @@ declare class RulerTool implements Extension {
|
|
|
928
926
|
[ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
|
|
929
927
|
[ContributionPointIds.COMMANDS]: CommandContribution[];
|
|
930
928
|
};
|
|
929
|
+
private isDebugEnabled;
|
|
931
930
|
private log;
|
|
932
931
|
private syncConfig;
|
|
933
932
|
private toFiniteNumber;
|