mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 17:31:38 +02:00
🐛 Fix problem with lines and inside/outside stroke
This commit is contained in:
parent
65894bf582
commit
0ca7d074ac
4 changed files with 36 additions and 18 deletions
|
@ -27,6 +27,7 @@
|
||||||
- Fix stroke caps adjustments in relation with stroke size [Taiga #2123](https://tree.taiga.io/project/penpot/issue/2123)
|
- Fix stroke caps adjustments in relation with stroke size [Taiga #2123](https://tree.taiga.io/project/penpot/issue/2123)
|
||||||
- Fix problem duplicating paths [Taiga #2147](https://tree.taiga.io/project/penpot/issue/2147)
|
- Fix problem duplicating paths [Taiga #2147](https://tree.taiga.io/project/penpot/issue/2147)
|
||||||
- Fix problem inheriting attributes from SVG root when importing [Taiga #2124](https://tree.taiga.io/project/penpot/issue/2124)
|
- Fix problem inheriting attributes from SVG root when importing [Taiga #2124](https://tree.taiga.io/project/penpot/issue/2124)
|
||||||
|
- Fix problem with lines and inside/outside stroke [Taiga #2146](https://tree.taiga.io/project/penpot/issue/2146)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
### :boom: Breaking changes
|
### :boom: Breaking changes
|
||||||
|
|
|
@ -160,6 +160,7 @@
|
||||||
;; PATHS
|
;; PATHS
|
||||||
(d/export gsp/content->selrect)
|
(d/export gsp/content->selrect)
|
||||||
(d/export gsp/transform-content)
|
(d/export gsp/transform-content)
|
||||||
|
(d/export gsp/open-path?)
|
||||||
|
|
||||||
;; Intersection
|
;; Intersection
|
||||||
(d/export gin/overlaps?)
|
(d/export gin/overlaps?)
|
||||||
|
|
|
@ -948,3 +948,14 @@
|
||||||
(gsc/transform-points points-center transform-inverse)
|
(gsc/transform-points points-center transform-inverse)
|
||||||
(gpr/points->selrect))]
|
(gpr/points->selrect))]
|
||||||
[points selrect]))
|
[points selrect]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn open-path?
|
||||||
|
[shape]
|
||||||
|
|
||||||
|
(and (= :path (:type shape))
|
||||||
|
(not (->> shape
|
||||||
|
:content
|
||||||
|
(sp/close-subpaths)
|
||||||
|
(sp/get-subpaths)
|
||||||
|
(every? sp/is-closed?)))))
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
(ns app.main.ui.shapes.custom-stroke
|
(ns app.main.ui.shapes.custom-stroke
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.main.ui.context :as muc]
|
[app.main.ui.context :as muc]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
|
@ -145,6 +146,8 @@
|
||||||
|
|
||||||
(mf/defc stroke-defs
|
(mf/defc stroke-defs
|
||||||
[{:keys [shape render-id]}]
|
[{:keys [shape render-id]}]
|
||||||
|
(when (and (= (:type shape) :path)
|
||||||
|
(gsh/open-path? shape))
|
||||||
(cond
|
(cond
|
||||||
(and (= :inner (:stroke-alignment shape :center))
|
(and (= :inner (:stroke-alignment shape :center))
|
||||||
(> (:stroke-width shape 0) 0))
|
(> (:stroke-width shape 0) 0))
|
||||||
|
@ -160,7 +163,7 @@
|
||||||
(some? (:stroke-cap-end shape)))
|
(some? (:stroke-cap-end shape)))
|
||||||
(= (:stroke-alignment shape) :center))
|
(= (:stroke-alignment shape) :center))
|
||||||
[:& cap-markers {:shape shape
|
[:& cap-markers {:shape shape
|
||||||
:render-id render-id}]))
|
:render-id render-id}])))
|
||||||
|
|
||||||
;; Outer alingmnent: display the shape in two layers. One
|
;; Outer alingmnent: display the shape in two layers. One
|
||||||
;; without stroke (only fill), and another one only with stroke
|
;; without stroke (only fill), and another one only with stroke
|
||||||
|
@ -253,15 +256,17 @@
|
||||||
stroke-position (:stroke-alignment shape :center)
|
stroke-position (:stroke-alignment shape :center)
|
||||||
has-stroke? (and (> stroke-width 0)
|
has-stroke? (and (> stroke-width 0)
|
||||||
(not= stroke-style :none))
|
(not= stroke-style :none))
|
||||||
|
closed? (or (not= :path (:type shape))
|
||||||
|
(not (gsh/open-path? shape)))
|
||||||
inner? (= :inner stroke-position)
|
inner? (= :inner stroke-position)
|
||||||
outer? (= :outer stroke-position)]
|
outer? (= :outer stroke-position)]
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
(and has-stroke? inner?)
|
(and has-stroke? inner? closed?)
|
||||||
[:& inner-stroke {:shape shape}
|
[:& inner-stroke {:shape shape}
|
||||||
child]
|
child]
|
||||||
|
|
||||||
(and has-stroke? outer?)
|
(and has-stroke? outer? closed?)
|
||||||
[:& outer-stroke {:shape shape}
|
[:& outer-stroke {:shape shape}
|
||||||
child]
|
child]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue