diff --git a/frontend/src/uxbox/main/data/workspace/persistence.cljs b/frontend/src/uxbox/main/data/workspace/persistence.cljs index 9a54ccd3d..5a7dafd2b 100644 --- a/frontend/src/uxbox/main/data/workspace/persistence.cljs +++ b/frontend/src/uxbox/main/data/workspace/persistence.cljs @@ -117,7 +117,6 @@ (s/keys :req-un [::id ::name ::file-id - ::version ::revn ::created-at ::modified-at diff --git a/frontend/src/uxbox/main/snap.cljs b/frontend/src/uxbox/main/snap.cljs index 87bf26e73..5ede74426 100644 --- a/frontend/src/uxbox/main/snap.cljs +++ b/frontend/src/uxbox/main/snap.cljs @@ -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))] diff --git a/frontend/src/uxbox/main/ui/viewer/shapes.cljs b/frontend/src/uxbox/main/ui/viewer/shapes.cljs index 6e291b665..5c1afffea 100644 --- a/frontend/src/uxbox/main/ui/viewer/shapes.cljs +++ b/frontend/src/uxbox/main/ui/viewer/shapes.cljs @@ -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])))) diff --git a/frontend/src/uxbox/main/ui/workspace/snap_distances.cljs b/frontend/src/uxbox/main/ui/workspace/snap_distances.cljs index 96e5030aa..98c56c8ad 100644 --- a/frontend/src/uxbox/main/ui/workspace/snap_distances.cljs +++ b/frontend/src/uxbox/main/ui/workspace/snap_distances.cljs @@ -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]