mirror of
https://github.com/penpot/penpot.git
synced 2025-03-29 08:01:41 -05:00
✨ Fix problem with constraints
This commit is contained in:
parent
56efb571be
commit
39041bb63b
5 changed files with 15 additions and 7 deletions
|
@ -151,7 +151,9 @@
|
||||||
(let [angl (gpt/angle-with-other before-v after-v)
|
(let [angl (gpt/angle-with-other before-v after-v)
|
||||||
sign (if (mth/close? angl 180) -1 1)
|
sign (if (mth/close? angl 180) -1 1)
|
||||||
length (* sign (gpt/length before-v))]
|
length (* sign (gpt/length before-v))]
|
||||||
(gpt/subtract after-v (gpt/scale (gpt/unit after-v) length))))
|
(if (mth/almost-zero? length)
|
||||||
|
after-v
|
||||||
|
(gpt/subtract after-v (gpt/scale (gpt/unit after-v) length)))))
|
||||||
|
|
||||||
(defn side-vector
|
(defn side-vector
|
||||||
[axis [c0 c1 _ c3]]
|
[axis [c0 c1 _ c3]]
|
||||||
|
|
|
@ -78,8 +78,8 @@
|
||||||
has-group? (->> selected-shapes (d/seek cph/group-shape?))
|
has-group? (->> selected-shapes (d/seek cph/group-shape?))
|
||||||
is-group? (and single? has-group?)]
|
is-group? (and single? has-group?)]
|
||||||
(if is-group?
|
(if is-group?
|
||||||
(let [parent-id (:parent-id (first selected-shapes))
|
(let [new-shape-id (uuid/next)
|
||||||
new-shape-id (uuid/next)
|
parent-id (:parent-id (first selected-shapes))
|
||||||
shapes-ids (:shapes (first selected-shapes))
|
shapes-ids (:shapes (first selected-shapes))
|
||||||
ordered-ids (into (d/ordered-set) shapes-ids)]
|
ordered-ids (into (d/ordered-set) shapes-ids)]
|
||||||
(rx/of (dwse/select-shapes ordered-ids)
|
(rx/of (dwse/select-shapes ordered-ids)
|
||||||
|
|
|
@ -300,6 +300,7 @@
|
||||||
(assoc :frame-id frame-id)
|
(assoc :frame-id frame-id)
|
||||||
(cts/setup-rect-selrect))]
|
(cts/setup-rect-selrect))]
|
||||||
(rx/of (add-shape shape))))))
|
(rx/of (add-shape shape))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Artboard
|
;; Artboard
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -199,6 +199,8 @@
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps disable?)
|
(mf/deps disable?)
|
||||||
(fn []
|
(fn []
|
||||||
|
(when (and disable? (not @disable-ref?))
|
||||||
|
(rx/push! updates-str :update))
|
||||||
(reset! disable-ref? disable?)))
|
(reset! disable-ref? disable?)))
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
(ns app.main.ui.workspace.sidebar.options.rows.stroke-row
|
(ns app.main.ui.workspace.sidebar.options.rows.stroke-row
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
|
[app.common.data.macros :as dm]
|
||||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||||
[app.main.ui.components.numeric-input :refer [numeric-input]]
|
[app.main.ui.components.numeric-input :refer [numeric-input]]
|
||||||
[app.main.ui.hooks :as h]
|
[app.main.ui.hooks :as h]
|
||||||
|
@ -132,9 +133,10 @@
|
||||||
:on-close (close-caps-select start-caps-state)}
|
:on-close (close-caps-select start-caps-state)}
|
||||||
[:ul.dropdown.cap-select-dropdown {:style {:top (:top @start-caps-state)
|
[:ul.dropdown.cap-select-dropdown {:style {:top (:top @start-caps-state)
|
||||||
:left (:left @start-caps-state)}}
|
:left (:left @start-caps-state)}}
|
||||||
(for [[value label separator] (stroke-cap-names)]
|
(for [[idx [value label separator]] (d/enumerate (stroke-cap-names))]
|
||||||
(let [img (value->img value)]
|
(let [img (value->img value)]
|
||||||
[:li {:class (dom/classnames :separator separator)
|
[:li {:key (dm/str "start-cap-" idx)
|
||||||
|
:class (dom/classnames :separator separator)
|
||||||
:on-click #(on-stroke-cap-start-change index value)}
|
:on-click #(on-stroke-cap-start-change index value)}
|
||||||
(when img [:img {:src (value->img value)}])
|
(when img [:img {:src (value->img value)}])
|
||||||
label]))]]
|
label]))]]
|
||||||
|
@ -151,9 +153,10 @@
|
||||||
:on-close (close-caps-select end-caps-state)}
|
:on-close (close-caps-select end-caps-state)}
|
||||||
[:ul.dropdown.cap-select-dropdown {:style {:top (:top @end-caps-state)
|
[:ul.dropdown.cap-select-dropdown {:style {:top (:top @end-caps-state)
|
||||||
:left (:left @end-caps-state)}}
|
:left (:left @end-caps-state)}}
|
||||||
(for [[value label separator] (stroke-cap-names)]
|
(for [[idx [value label separator]] (d/enumerate (stroke-cap-names))]
|
||||||
(let [img (value->img value)]
|
(let [img (value->img value)]
|
||||||
[:li {:class (dom/classnames :separator separator)
|
[:li {:key (dm/str "end-cap-" idx)
|
||||||
|
:class (dom/classnames :separator separator)
|
||||||
:on-click #(on-stroke-cap-end-change index value)}
|
:on-click #(on-stroke-cap-end-change index value)}
|
||||||
(when img [:img {:src (value->img value)}])
|
(when img [:img {:src (value->img value)}])
|
||||||
label]))]]])]))
|
label]))]]])]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue