feat(proxy): add offset param to inset or outset traced shapes

Trace results can now be inset (negative) or outset (positive) by a
pixel amount. Offset the outline and holes in opposite directions with
clipper-lib's miter joins, then recombine with a boolean difference so
holes grow on inset and shrink on outset. Collapsed shapes return an
empty outline; a split outline keeps the largest ring. Document the
parameter and the new dependency.
This commit is contained in:
2026-08-08 15:37:27 +08:00
parent c7f4bd03fd
commit 9094ad58e0
12 changed files with 284 additions and 17 deletions
+16
View File
@@ -32,6 +32,9 @@ importers:
bson:
specifier: ^6.10.4
version: 6.10.4
clipper-lib:
specifier: ^6.4.2
version: 6.4.2
hono:
specifier: ^4.6.14
version: 4.13.1
@@ -45,6 +48,9 @@ importers:
specifier: ^3.24.1
version: 3.25.76
devDependencies:
'@types/clipper-lib':
specifier: ^6.4.0
version: 6.4.0
'@types/node':
specifier: ^22.10.2
version: 22.20.1
@@ -802,6 +808,9 @@ packages:
'@types/chai@5.2.3':
resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
'@types/clipper-lib@6.4.0':
resolution: {integrity: sha512-y8WVQWLCIJobtcxk8SJj1f7OGVbQEL7RmfGtrWDkAKFxq2U6F0/7/hLYvDWlUnBayvnRYkq+QVZaUzm13mu+Ng==}
'@types/deep-eql@4.0.2':
resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
@@ -927,6 +936,9 @@ packages:
resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==}
engines: {node: '>=18'}
clipper-lib@6.4.2:
resolution: {integrity: sha512-knglhjQX5ihNj/XCIs6zCHrTemdvHY3LPZP9XB2nq2/3igyYMFueFXtfp84baJvEE+f8pO1ZS4UVeEgmLnAprQ==}
convert-source-map@2.0.0:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
@@ -2004,6 +2016,8 @@ snapshots:
'@types/deep-eql': 4.0.2
assertion-error: 2.0.1
'@types/clipper-lib@6.4.0': {}
'@types/deep-eql@4.0.2': {}
'@types/draco3d@1.4.10': {}
@@ -2121,6 +2135,8 @@ snapshots:
chai@6.2.2: {}
clipper-lib@6.4.2: {}
convert-source-map@2.0.0: {}
cookie@1.1.1: {}