diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-11-14 09:53:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-14 09:53:41 +0100 |
| commit | cf89e2daac4c533a4553695d1a3600a0522a3115 (patch) | |
| tree | e61ad7598525ef8f75f1f361312a5b8de633db27 /lib/extensions | |
| parent | 87403aec4edd9496645556b7358ecc5f02637e6d (diff) | |
stitch_plan lower opacity option: handle invisible elements better (#1434)
Diffstat (limited to 'lib/extensions')
| -rw-r--r-- | lib/extensions/stitch_plan_preview.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/extensions/stitch_plan_preview.py b/lib/extensions/stitch_plan_preview.py index e893e8fd..04168665 100644 --- a/lib/extensions/stitch_plan_preview.py +++ b/lib/extensions/stitch_plan_preview.py @@ -3,7 +3,7 @@ # Copyright (c) 2010 Authors # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. -from inkex import Boolean +from inkex import Boolean, Style from lxml import etree from ..stitch_plan import stitch_groups_to_stitch_plan @@ -45,11 +45,15 @@ class StitchPlanPreview(InkstitchExtension): if self.options.layer_visibility == 1: self.hide_all_layers() layer.set('style', None) - - if self.options.layer_visibility == 2: + elif self.options.layer_visibility == 2: for g in self.document.getroot().findall(SVG_GROUP_TAG): - if g.get(INKSCAPE_GROUPMODE) == "layer" and not g == layer: - g.set("style", "opacity:0.4") + style = g.specified_style() + # check groupmode and exclude stitch_plan layer + # exclude objects which are not displayed at all or already have opacity < 0.4 + if (g.get(INKSCAPE_GROUPMODE) == "layer" and not g == layer and + float(style.get('opacity', 1)) > 0.4 and not style.get('display', 'inline') == 'none'): + style += Style('opacity:0.4') + g.set("style", style) # translate stitch plan to the right side of the canvas if self.options.move_to_side: |
