mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 12:31:38 +02: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)))
|
(if (> num to) to num)))
|
||||||
|
|
||||||
(defn almost-zero? [num]
|
(defn almost-zero? [num]
|
||||||
(< (abs num) 1e-5))
|
(< (abs (double num)) 1e-5))
|
||||||
|
|
||||||
(defonce float-equal-precision 0.001)
|
(defonce float-equal-precision 0.001)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.common.pages :as cp]
|
[app.common.pages :as cp]
|
||||||
|
[app.common.path.commands :as upc]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[okulary.core :as l]))
|
[okulary.core :as l]))
|
||||||
|
@ -255,13 +256,19 @@
|
||||||
(into [] xform ids)))]
|
(into [] xform ids)))]
|
||||||
(l/derived selector st/state =))))
|
(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]
|
(defn select-children [id]
|
||||||
(let [selector
|
(let [selector
|
||||||
(fn [state]
|
(fn [state]
|
||||||
(let [objects (wsh/lookup-page-objects 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}
|
{selected :selected disp-modifiers :modifiers}
|
||||||
(-> (:workspace-local state)
|
(-> (:workspace-local state)
|
||||||
(select-keys [:modifiers :selected]))
|
(select-keys [:modifiers :selected]))
|
||||||
|
@ -271,7 +278,9 @@
|
||||||
modifiers
|
modifiers
|
||||||
(into {} (map #(vector % {:modifiers disp-modifiers})) selected))]
|
(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 =)))
|
(l/derived selector st/state =)))
|
||||||
|
|
||||||
(def selected-data
|
(def selected-data
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
(mf/use-memo
|
(mf/use-memo
|
||||||
(mf/deps shape childs)
|
(mf/deps shape childs)
|
||||||
(fn []
|
(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)
|
(->> (:shapes shape)
|
||||||
(map #(get childs %))
|
(map #(get childs %))
|
||||||
(filter #(not (:hidden %)))
|
(filter #(not (:hidden %)))
|
||||||
|
|
|
@ -272,6 +272,10 @@
|
||||||
(reset! hover-point (when (< (gpt/distance position point) (/ 10 zoom)) point)))))
|
(reset! hover-point (when (< (gpt/distance position point) (/ 10 zoom)) point)))))
|
||||||
|
|
||||||
[:g.path-editor {:ref editor-ref}
|
[: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))
|
(when (and preview (not drag-handler))
|
||||||
[:& path-preview {:command preview
|
[:& path-preview {:command preview
|
||||||
:from last-p
|
:from last-p
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue