diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-08-22 21:56:36 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-08-24 20:54:12 -0400 |
| commit | d4acb52d6983e5e47f526aaf6216372291385016 (patch) | |
| tree | 78c9bd8aaa10645f120f24860a4ea2c2fa0ec0db /lib/commands.py | |
| parent | b5cd6125a4e227c63830ff092a8885edcabcfaeb (diff) | |
add `point` property to StandaloneCommand
Diffstat (limited to 'lib/commands.py')
| -rw-r--r-- | lib/commands.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/commands.py b/lib/commands.py index 7764539c..b9cf9610 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -1,9 +1,9 @@ import inkex import cubicsuperpath -from .svg import apply_transforms +from .svg import apply_transforms, get_node_transform from .svg.tags import SVG_USE_TAG, SVG_SYMBOL_TAG, CONNECTION_START, CONNECTION_END, XLINK_HREF -from .utils import cache +from .utils import cache, Point from .i18n import _, N_ COMMANDS = { @@ -117,6 +117,15 @@ class StandaloneCommand(BaseCommand): self.parse_symbol() + @property + @cache + def point(self): + pos = [float(self.node.get("x", 0)), float(self.node.get("y", 0))] + transform = get_node_transform(self.node) + simpletransform.applyTransformToPoint(transform, pos) + + return Point(*pos) + def get_command_description(command): return _(COMMANDS[command]) |
