[Path] preserve cap extensions in normalized form, and scale them with scale()
This commit is contained in:
parent
1bcf5901d6
commit
3beadd2bf0
3 changed files with 52 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ from ..pattern import Pattern
|
|||
from ..error import LibraryError, PatternError
|
||||
from ..ports import Port
|
||||
from ..repetition import Grid
|
||||
from ..shapes import Path
|
||||
from ..file.utils import preflight
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -243,3 +244,18 @@ def test_library_get_name() -> None:
|
|||
|
||||
name2 = lib.get_name("other")
|
||||
assert name2 == "other"
|
||||
|
||||
|
||||
def test_library_dedup_shapes_does_not_merge_custom_capped_paths() -> None:
|
||||
lib = Library()
|
||||
pat = Pattern()
|
||||
pat.shapes[(1, 0)] += [
|
||||
Path(vertices=[[0, 0], [10, 0]], width=2, cap=Path.Cap.SquareCustom, cap_extensions=(1, 2)),
|
||||
Path(vertices=[[20, 0], [30, 0]], width=2, cap=Path.Cap.SquareCustom, cap_extensions=(3, 4)),
|
||||
]
|
||||
lib["top"] = pat
|
||||
|
||||
lib.dedup(norm_value=1, threshold=2)
|
||||
|
||||
assert not lib["top"].refs
|
||||
assert len(lib["top"].shapes[(1, 0)]) == 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue