mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05:00
🐛 Fixed some problems with booleans and paths
This commit is contained in:
parent
ff8db0cd77
commit
a189dc8243
4 changed files with 18 additions and 5 deletions
|
@ -150,7 +150,7 @@
|
|||
(if (> num to) to num)))
|
||||
|
||||
(defn almost-zero? [num]
|
||||
(< (abs num) 1e-5))
|
||||
(< (abs (double num)) 1e-5))
|
||||
|
||||
(defonce float-equal-precision 0.001)
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.path.commands :as upc]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.store :as st]
|
||||
[okulary.core :as l]))
|
||||
|
@ -255,13 +256,19 @@
|
|||
(into [] xform ids)))]
|
||||
(l/derived selector st/state =))))
|
||||
|
||||
(defn- set-content-modifiers [state]
|
||||
(fn [id shape]
|
||||
(let [content-modifiers (get-in state [:workspace-local :edit-path id :content-modifiers])]
|
||||
(if (some? content-modifiers)
|
||||
(update shape :content upc/apply-content-modifiers content-modifiers)
|
||||
shape))))
|
||||
|
||||
(defn select-children [id]
|
||||
(let [selector
|
||||
(fn [state]
|
||||
(let [objects (wsh/lookup-page-objects state)
|
||||
children (cp/select-children id objects)
|
||||
modifiers (-> (:workspace-modifiers state))
|
||||
|
||||
modifiers (-> (:workspace-modifiers state))
|
||||
{selected :selected disp-modifiers :modifiers}
|
||||
(-> (:workspace-local state)
|
||||
(select-keys [:modifiers :selected]))
|
||||
|
@ -271,7 +278,9 @@
|
|||
modifiers
|
||||
(into {} (map #(vector % {:modifiers disp-modifiers})) selected))]
|
||||
|
||||
(gsh/merge-modifiers children modifiers)))]
|
||||
(as-> (cp/select-children id objects) $
|
||||
(gsh/merge-modifiers $ modifiers)
|
||||
(d/mapm (set-content-modifiers state) $))))]
|
||||
(l/derived selector st/state =)))
|
||||
|
||||
(def selected-data
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
(mf/use-memo
|
||||
(mf/deps shape childs)
|
||||
(fn []
|
||||
(let [childs (d/mapm #(-> %2 (gsh/translate-to-frame frame) gsh/transform-shape) childs)]
|
||||
(let [childs (d/mapm #(-> %2 gsh/transform-shape (gsh/translate-to-frame frame)) childs)]
|
||||
(->> (:shapes shape)
|
||||
(map #(get childs %))
|
||||
(filter #(not (:hidden %)))
|
||||
|
|
|
@ -272,6 +272,10 @@
|
|||
(reset! hover-point (when (< (gpt/distance position point) (/ 10 zoom)) point)))))
|
||||
|
||||
[:g.path-editor {:ref editor-ref}
|
||||
[:path {:d (upf/format-path content)
|
||||
:style {:fill "none"
|
||||
:stroke pc/primary-color
|
||||
:strokeWidth (/ 1 zoom)}}]
|
||||
(when (and preview (not drag-handler))
|
||||
[:& path-preview {:command preview
|
||||
:from last-p
|
||||
|
|
Loading…
Add table
Reference in a new issue