Fix style for bool shapes

This commit is contained in:
alonso.torres 2021-09-24 16:28:12 +02:00
parent c3520cf606
commit 8c25ee7796
3 changed files with 98 additions and 37 deletions

View file

@ -25,6 +25,23 @@
childs (use-equal-memo childs)
;;[content-a content-b]
;;(mf/use-memo
;; (mf/deps shape childs)
;; (fn []
;; (let [childs (d/mapm #(gsh/transform-shape %2) childs)
;; [content-a content-b]
;; (->> (:shapes shape)
;; (map #(get childs %))
;; (filter #(not (:hidden %)))
;; (map #(stp/convert-to-path % childs))
;; (mapv :content)
;; (mapv pb/add-previous))]
;; (pb/content-intersect-split content-a content-b))))
;;_ (.log js/console "content-a" (clj->js content-a))
;;_ (.log js/console "content-b" (clj->js content-b))
bool-content
(mf/use-memo
(mf/deps shape childs)
@ -35,9 +52,45 @@
(filter #(not (:hidden %)))
(map #(stp/convert-to-path % childs))
(mapv :content)
(pb/content-bool (:bool-type shape))))))]
(pb/content-bool (:bool-type shape))))))
]
[:& shape-wrapper {:shape (-> shape
(assoc :type :path)
(assoc :content bool-content))
:frame frame}])))
[:*
[:& shape-wrapper {:shape (-> shape
(assoc :type :path)
(assoc :content bool-content))
:frame frame}]
#_[:*
[:g
[:& shape-wrapper {:shape (-> shape
(assoc :type :path)
(assoc :stroke-color "blue")
(assoc :stroke-opacity 1)
(assoc :stroke-width 0.5)
(assoc :stroke-style :solid)
(dissoc :fill-color :fill-opacity)
(assoc :content content-b))
:frame frame}]
(for [{:keys [x y]} (app.common.geom.shapes.path/content->points content-b)]
[:circle {:cx x
:cy y
:r 2.5
:style {:fill "blue"}}])]
[:g
[:& shape-wrapper {:shape (-> shape
(assoc :type :path)
(assoc :stroke-color "red")
(assoc :stroke-opacity 1)
(assoc :stroke-width 0.5)
(assoc :stroke-style :solid)
(dissoc :fill-color :fill-opacity)
(assoc :content content-a))
:frame frame}]
(for [{:keys [x y]} (app.common.geom.shapes.path/content->points content-a)]
[:circle {:cx x
:cy y
:r 1.25
:style {:fill "red"}}])]]])))