diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-03-11 11:15:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-11 11:15:51 +0100 |
| commit | 5cfaa83be390cfec6fd5b3d0353458025164d3c7 (patch) | |
| tree | fc1fa40eabde4b7f2d322f51937aed31fb0d467a | |
| parent | 0a0d10afcf5d9f4899728ffecd838d97d6545d54 (diff) | |
shift command position of commands with connector lines a little bit out (#3572)
| -rw-r--r-- | lib/commands.py | 9 | ||||
| -rw-r--r-- | lib/threads/color.py | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/commands.py b/lib/commands.py index abef3912..3058c740 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -416,14 +416,14 @@ def add_symbol(document, group, command, pos): return symbol -def get_command_pos(element, index, total): +def get_command_pos(element, index, total, distance=10): # Put command symbols on the outline of the shape, spaced evenly around it. if element.name == "Stroke": shape = element.as_multi_line_string() else: shape = element.shape - polygon = ensure_multi_polygon(shape.buffer(0.01)).geoms[-1] + polygon = ensure_multi_polygon(shape.buffer(distance)).geoms[-1] outline = polygon.exterior # pick this item's spot around the outline and perturb it a bit to avoid @@ -443,7 +443,10 @@ def add_commands(element, commands, pos=None): group = add_group(svg, element.node, command) position = pos if position is None: - position = get_command_pos(element, i, len(commands)) + if command in HIDDEN_CONNECTOR_COMMANDS: + position = get_command_pos(element, i, len(commands), 0.1) + else: + position = get_command_pos(element, i, len(commands)) symbol = add_symbol(svg, group, command, position) add_connector(svg, symbol, command, element) diff --git a/lib/threads/color.py b/lib/threads/color.py index e71ebb06..ef655045 100644 --- a/lib/threads/color.py +++ b/lib/threads/color.py @@ -4,7 +4,6 @@ # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. import colorsys -import re from inkex import Color from pyembroidery.EmbThread import EmbThread @@ -34,7 +33,7 @@ class ThreadColor(object): self.rgb = (color.get_red(), color.get_green(), color.get_blue()) return elif isinstance(color, str): - self.rgb = Color(color).to('rgb').get_values(False) + self.rgb = tuple(Color(color).to('rgb').get_values(False)) elif isinstance(color, (list, tuple)): self.rgb = tuple(color) else: |
