mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 16:21:57 -05:00
🐛 Fixes problems with preview
This commit is contained in:
parent
738a791a27
commit
721879aaa8
4 changed files with 15 additions and 13 deletions
|
@ -117,7 +117,6 @@
|
|||
(s/keys :req-un [::id
|
||||
::name
|
||||
::file-id
|
||||
::version
|
||||
::revn
|
||||
::created-at
|
||||
::modified-at
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
[uxbox.util.geom.snap-points :as sp]))
|
||||
|
||||
(def ^:private snap-accuracy 5)
|
||||
(def ^:private snap-distance-accuracy 10)
|
||||
(def ^:private snap-distance-accuracy 5)
|
||||
|
||||
(defn- remove-from-snap-points [remove-id?]
|
||||
(fn [query-result]
|
||||
|
@ -162,7 +162,7 @@
|
|||
(-> % gsh/selection-rect (gsh/move movev))))
|
||||
(rx/merge-map
|
||||
(fn [[frame selrect]]
|
||||
(let [areas (->> (gsh/selrect->areas (or (:selrect frame) @refs/vbox) selrect)
|
||||
(let [areas (->> (gsh/selrect->areas (or (:selrect frame) (gsh/rect->rect-shape @refs/vbox)) selrect)
|
||||
(d/mapm #(select-shapes-area page-id shapes objects %2)))
|
||||
snap-x (search-snap-distance selrect :x (:left areas) (:right areas))
|
||||
snap-y (search-snap-distance selrect :y (:top areas) (:bottom areas))]
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
(mf/fnc generic-wrapper
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
(let [{:keys [x y width height]
|
||||
:as shape} (->> (unchecked-get props "shape") :selrect)
|
||||
(let [shape (unchecked-get props "shape")
|
||||
{:keys [x y width height]} (:selrect shape)
|
||||
|
||||
childs (unchecked-get props "childs")
|
||||
frame (unchecked-get props "frame")
|
||||
|
@ -114,7 +114,8 @@
|
|||
childs (mapv #(get objects %) (:shapes shape))
|
||||
shape (geom/transform-shape shape)
|
||||
props (obj/merge! #js {} props
|
||||
#js {:childs childs
|
||||
#js {:shape shape
|
||||
:childs childs
|
||||
:show-interactions? show-interactions?})]
|
||||
[:> frame-wrapper props]))))
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
half-point))
|
||||
|
||||
(def pill-text-width-letter 6)
|
||||
(def pill-text-width-margin 12)
|
||||
(def pill-text-width-margin 6)
|
||||
(def pill-text-font-size 12)
|
||||
(def pill-text-height 20)
|
||||
(def pill-text-border-radius 4)
|
||||
|
@ -52,10 +52,11 @@
|
|||
to-c (max (get sr1 (if (= :x coord) :x1 :y1))
|
||||
(get sr2 (if (= :x coord) :x1 :y1)))
|
||||
|
||||
distance (mth/round (- to-c from-c))
|
||||
distance (- to-c from-c)
|
||||
distance-str (-> distance (mth/precision 2) str)
|
||||
half-point (half-point coord sr1 sr2)
|
||||
width (-> distance
|
||||
mth/log10 ;; number of digits
|
||||
width (-> distance-str
|
||||
count
|
||||
(* (/ pill-text-width-letter zoom))
|
||||
(+ (/ pill-text-width-margin zoom)))]
|
||||
|
||||
|
@ -79,7 +80,7 @@
|
|||
:font-size (/ pill-text-font-size zoom)
|
||||
:fill "white"
|
||||
:text-anchor "middle"}
|
||||
(mth/round distance)]])
|
||||
(mth/precision distance 2)]])
|
||||
|
||||
(let [p1 [(+ from-c (/ segment-gap zoom)) (+ half-point (/ segment-gap-side zoom))]
|
||||
p2 [(+ from-c (/ segment-gap zoom)) (- half-point (/ segment-gap-side zoom))]
|
||||
|
@ -123,7 +124,8 @@
|
|||
(fn [[selrect selected frame]]
|
||||
(let [lt-side (if (= coord :x) :left :top)
|
||||
gt-side (if (= coord :x) :right :bottom)
|
||||
areas (gsh/selrect->areas (or (:selrect frame) @refs/vbox) selrect)
|
||||
areas (gsh/selrect->areas (or (:selrect frame)
|
||||
(gsh/rect->rect-shape @refs/vbox)) selrect)
|
||||
query-side (fn [side]
|
||||
(->> (uw/ask! {:cmd :selection/query
|
||||
:page-id page-id
|
||||
|
@ -141,7 +143,7 @@
|
|||
(gsh/distance-selrect sr selrect)
|
||||
(gsh/distance-selrect selrect sr))
|
||||
coord
|
||||
mth/round)))
|
||||
(mth/precision 2))))
|
||||
|
||||
get-shapes-match
|
||||
(fn [pred? shapes]
|
||||
|
|
Loading…
Add table
Reference in a new issue