@pooder/kit 5.1.0 → 5.3.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/.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/extensions/background.js +203 -0
- package/.test-dist/src/extensions/bridgeSelection.js +20 -0
- package/.test-dist/src/extensions/constraints.js +237 -0
- package/.test-dist/src/extensions/dieline.js +828 -0
- package/.test-dist/src/extensions/edgeScale.js +12 -0
- package/.test-dist/src/extensions/feature.js +825 -0
- package/.test-dist/src/extensions/featureComplete.js +32 -0
- package/.test-dist/src/extensions/film.js +167 -0
- package/.test-dist/src/extensions/geometry.js +545 -0
- package/.test-dist/src/extensions/image.js +1529 -0
- package/.test-dist/src/extensions/index.js +30 -0
- package/.test-dist/src/extensions/maskOps.js +279 -0
- package/.test-dist/src/extensions/mirror.js +104 -0
- package/.test-dist/src/extensions/ruler.js +345 -0
- package/.test-dist/src/extensions/sceneLayout.js +96 -0
- package/.test-dist/src/extensions/sceneLayoutModel.js +196 -0
- package/.test-dist/src/extensions/sceneVisibility.js +62 -0
- package/.test-dist/src/extensions/size.js +331 -0
- package/.test-dist/src/extensions/tracer.js +538 -0
- package/.test-dist/src/extensions/white-ink.js +1190 -0
- package/.test-dist/src/extensions/wrappedOffsets.js +33 -0
- 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/index.js +2 -19
- 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/services/CanvasService.js +249 -0
- package/.test-dist/src/services/ViewportSystem.js +76 -0
- package/.test-dist/src/services/index.js +24 -0
- package/.test-dist/src/services/renderSpec.js +2 -0
- 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 +12 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +3521 -3220
- package/dist/index.mjs +3532 -3226
- 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 +20 -17
- 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 +719 -719
- package/src/extensions/image.ts +1924 -1594
- package/src/extensions/index.ts +11 -11
- package/src/extensions/maskOps.ts +365 -299
- 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 +342 -342
- package/src/extensions/sceneVisibility.ts +71 -71
- package/src/extensions/size.ts +389 -389
- package/src/extensions/tracer.ts +302 -370
- package/src/extensions/white-ink.ts +1489 -1366
- 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
|
@@ -433,10 +433,26 @@ export class DielineTool implements Extension {
|
|
|
433
433
|
{
|
|
434
434
|
command: "detectEdge",
|
|
435
435
|
title: "Detect Edge from Image",
|
|
436
|
-
handler: async (
|
|
436
|
+
handler: async (
|
|
437
|
+
imageUrl: string,
|
|
438
|
+
options?: {
|
|
439
|
+
expand?: number;
|
|
440
|
+
smoothing?: boolean;
|
|
441
|
+
simplifyTolerance?: number;
|
|
442
|
+
threshold?: number;
|
|
443
|
+
debug?: boolean;
|
|
444
|
+
},
|
|
445
|
+
) => {
|
|
437
446
|
try {
|
|
438
447
|
const detectOptions = options || {};
|
|
439
448
|
const debug = detectOptions.debug === true;
|
|
449
|
+
const tracerOptions = {
|
|
450
|
+
expand: detectOptions.expand ?? 0,
|
|
451
|
+
smoothing: detectOptions.smoothing ?? true,
|
|
452
|
+
simplifyTolerance: detectOptions.simplifyTolerance ?? 2,
|
|
453
|
+
threshold: detectOptions.threshold,
|
|
454
|
+
debug,
|
|
455
|
+
};
|
|
440
456
|
|
|
441
457
|
// Helper to get image dimensions
|
|
442
458
|
const loadImage = (url: string): Promise<HTMLImageElement> => {
|
|
@@ -451,7 +467,7 @@ export class DielineTool implements Extension {
|
|
|
451
467
|
|
|
452
468
|
const [img, traced] = await Promise.all([
|
|
453
469
|
loadImage(imageUrl),
|
|
454
|
-
ImageTracer.traceWithBounds(imageUrl,
|
|
470
|
+
ImageTracer.traceWithBounds(imageUrl, tracerOptions),
|
|
455
471
|
]);
|
|
456
472
|
const { pathData, baseBounds, bounds } = traced;
|
|
457
473
|
|
|
@@ -463,21 +479,8 @@ export class DielineTool implements Extension {
|
|
|
463
479
|
expandedBounds: bounds,
|
|
464
480
|
currentDielineWidth: s.width,
|
|
465
481
|
currentDielineHeight: s.height,
|
|
466
|
-
options:
|
|
467
|
-
|
|
468
|
-
morphologyRadius: detectOptions.morphologyRadius,
|
|
469
|
-
connectRadiusMax: detectOptions.connectRadiusMax,
|
|
470
|
-
smoothing: detectOptions.smoothing,
|
|
471
|
-
simplifyTolerance: detectOptions.simplifyTolerance,
|
|
472
|
-
threshold: detectOptions.threshold,
|
|
473
|
-
maskMode: detectOptions.maskMode,
|
|
474
|
-
whiteThreshold: detectOptions.whiteThreshold,
|
|
475
|
-
alphaOpaqueCutoff: detectOptions.alphaOpaqueCutoff,
|
|
476
|
-
noChannels: detectOptions.noChannels,
|
|
477
|
-
componentMode: detectOptions.componentMode,
|
|
478
|
-
minComponentArea: detectOptions.minComponentArea,
|
|
479
|
-
forceConnected: detectOptions.forceConnected,
|
|
480
|
-
},
|
|
482
|
+
options: tracerOptions,
|
|
483
|
+
strategy: "single-connected-silhouette",
|
|
481
484
|
});
|
|
482
485
|
}
|
|
483
486
|
|
|
@@ -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
|
+
|