diff --git a/src/uxbox/main/data/shapes.cljs b/src/uxbox/main/data/shapes.cljs index bc34f205d..9e26bcda0 100644 --- a/src/uxbox/main/data/shapes.cljs +++ b/src/uxbox/main/data/shapes.cljs @@ -241,20 +241,6 @@ (update-in state [:shapes-by-id sid] assoc :proportion-lock false)))) -(defn setup-proportions - [sid] - {:pre [(uuid? sid)]} - (reify - udp/IPageUpdate - rs/UpdateEvent - (-apply-update [_ state] - (let [[width height] (-> (get-in state [:shapes-by-id sid]) - (geom/size) - (keep [:width :height])) - proportion (/ width height)] - (update-in state [:shapes-by-id sid] assoc - :proportion proportion))))) - ;; --- Group Collapsing (defn collapse-shape diff --git a/src/uxbox/main/geom.cljs b/src/uxbox/main/geom.cljs index db822e077..fdb3b0a4f 100644 --- a/src/uxbox/main/geom.cljs +++ b/src/uxbox/main/geom.cljs @@ -284,27 +284,28 @@ (declare setup-proportions-rect) (declare setup-proportions-image) -;; FIXME: improve proportions setup for icons. - (defn setup-proportions [shape] (case (:type shape) :rect (setup-proportions-rect shape) - :icon (setup-proportions-rect shape) :circle (setup-proportions-rect shape) + :icon (setup-proportions-image shape) :image (setup-proportions-image shape) - shape)) + :text shape)) (defn setup-proportions-image [{:keys [metadata] :as shape}] - (println "setup-proportions-image" shape) (let [{:keys [width height]} metadata] - (assoc shape :proportion (/ width height)))) + (assoc shape + :proportion (/ width height) + :proportion-lock true))) (defn setup-proportions-rect [shape] (let [{:keys [width height]} (size shape)] - (assoc shape :proportion (/ width height)))) + (assoc shape + :proportion (/ width height) + :proportion-lock true))) ;; --- Resize (Dimentsions) diff --git a/src/uxbox/main/ui/shapes/selection.cljs b/src/uxbox/main/ui/shapes/selection.cljs index 141ff336f..d76fe0d1a 100644 --- a/src/uxbox/main/ui/shapes/selection.cljs +++ b/src/uxbox/main/ui/shapes/selection.cljs @@ -49,7 +49,6 @@ (let [params {:vid vid :delta (assoc delta :lock ctrl?)}] (rs/emit! (uds/update-vertex-position sid params)))) (on-end [] - (rs/emit! (uds/setup-proportions sid)) (rlocks/release! :shape/resize))] (let [stoper (->> wb/events-s (rx/map first)