diff --git a/frontend/src/uxbox/main/data/workspace.cljs b/frontend/src/uxbox/main/data/workspace.cljs index 5c78f7ce5..9c9fdba08 100644 --- a/frontend/src/uxbox/main/data/workspace.cljs +++ b/frontend/src/uxbox/main/data/workspace.cljs @@ -39,7 +39,7 @@ [uxbox.util.transit :as t] [uxbox.util.webapi :as wapi] [uxbox.util.avatars :as avatars] - [uxbox.main.data.workspace.common :refer [IBatchedChange IUpdateGroup] :as common] + [uxbox.main.data.workspace.common :as dwc] [uxbox.main.data.workspace.transforms :as transforms])) ;; TODO: temporal workaround @@ -198,13 +198,13 @@ ptk/WatchEvent (watch [_ state stream] (->> stream - (rx/filter #(satisfies? IUpdateGroup %)) - (rx/map #(adjust-group-shapes (common/get-ids %))))))) + (rx/filter #(satisfies? dwc/IUpdateGroup %)) + (rx/map #(adjust-group-shapes (dwc/get-ids %))))))) (defn adjust-group-shapes [ids] (ptk/reify ::adjust-group-shapes - IBatchedChange + dwc/IBatchedChange ptk/UpdateEvent (update [_ state] @@ -395,12 +395,12 @@ (ptk/type? ::initialize-page %)) stream) notifier (->> stream - (rx/filter (ptk/type? ::common/commit-changes)) + (rx/filter (ptk/type? ::dwc/commit-changes)) (rx/debounce 2000) (rx/merge stoper))] (rx/merge (->> stream - (rx/filter (ptk/type? ::common/commit-changes)) + (rx/filter (ptk/type? ::dwc/commit-changes)) (rx/map deref) (rx/buffer-until notifier) (rx/map vec) @@ -408,9 +408,9 @@ (rx/map #(persist-changes page-id %)) (rx/take-until (rx/delay 100 stoper))) (->> stream - (rx/filter #(satisfies? IBatchedChange %)) + (rx/filter #(satisfies? dwc/IBatchedChange %)) (rx/debounce 200) - (rx/map (fn [_] (common/diff-and-commit-changes page-id))) + (rx/map (fn [_] (dwc/diff-and-commit-changes page-id))) (rx/take-until stoper))))))) (defn persist-changes @@ -892,7 +892,7 @@ frame-id (if (= :frame (:type shape)) uuid/zero - (common/calculate-frame-overlap objects shape)) + (dwc/calculate-frame-overlap objects shape)) shape (merge (if (= :frame (:type shape)) @@ -910,7 +910,7 @@ uchange {:type :del-obj :id id}] - (rx/of (common/commit-changes [rchange] [uchange] {:commit-local? true}) + (rx/of (dwc/commit-changes [rchange] [uchange] {:commit-local? true}) (select-shapes #{id})))))) @@ -957,7 +957,7 @@ moved-obj (geom/move renamed-obj delta) frame-id (if frame-id frame-id - (common/calculate-frame-overlap objects moved-obj)) + (dwc/calculate-frame-overlap objects moved-obj)) parent-id (or parent-id frame-id) @@ -1031,7 +1031,7 @@ (map #(get-in % [:obj :id])) (into #{}))] - (rx/of (common/commit-changes rchanges uchanges {:commit-local? true}) + (rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true}) (select-shapes selected)))))) @@ -1071,8 +1071,8 @@ (us/verify ::us/uuid id) (us/verify ::shape-attrs attrs) (ptk/reify ::update-shape - IBatchedChange - IUpdateGroup + dwc/IBatchedChange + dwc/IUpdateGroup (get-ids [_] [id]) ptk/UpdateEvent @@ -1086,7 +1086,7 @@ [opts] (us/verify ::cp/options opts) (ptk/reify ::update-options - IBatchedChange + dwc/IBatchedChange ptk/UpdateEvent (update [_ state] (let [pid (:current-page-id state)] @@ -1166,7 +1166,7 @@ :parent-id (get cpindex id) :obj obj})) (reverse (map :id rchanges)))] - (rx/of (common/commit-changes rchanges uchanges {:commit-local? true})))))) + (rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})))))) (def delete-selected "Deselect all and remove all selected shapes." @@ -1189,7 +1189,7 @@ (us/verify ::us/uuid id) (us/verify string? name) (ptk/reify ::rename-shape - IBatchedChange + dwc/IBatchedChange ptk/UpdateEvent (update [_ state] (let [page-id (:current-page-id state)] @@ -1221,7 +1221,7 @@ :id frame-id :operations [{:type :abs-order :id id :index cindex}]})) selected)] - (rx/of (common/commit-changes rchanges uchanges {:commit-local? true})))))) + (rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})))))) ;; --- Change Shape Order (D&D Ordering) @@ -1244,7 +1244,7 @@ selected (get-in state [:workspace-local :selected]) objects (get-in state [:workspace-data page-id :objects]) parent-id (helpers/get-parent ref-id objects)] - (rx/of (common/commit-changes [{:type :mov-objects + (rx/of (dwc/commit-changes [{:type :mov-objects :parent-id parent-id :index index :shapes (vec selected)}] @@ -1283,7 +1283,7 @@ [axis] (us/verify ::geom/align-axis axis) (ptk/reify :align-objects - IBatchedChange + dwc/IBatchedChange ptk/UpdateEvent (update [_ state] (let [page-id (:current-page-id state) @@ -1311,7 +1311,7 @@ [axis] (us/verify ::geom/dist-axis axis) (ptk/reify :align-objects - IBatchedChange + dwc/IBatchedChange ptk/UpdateEvent (update [_ state] (let [page-id (:current-page-id state) @@ -1400,8 +1400,8 @@ (us/verify #{:width :height} attr) (us/verify ::us/number value) (ptk/reify ::update-rect-dimensions - IBatchedChange - IUpdateGroup + dwc/IBatchedChange + dwc/IUpdateGroup (get-ids [_] [id]) ptk/UpdateEvent @@ -1410,23 +1410,6 @@ (update-in state [:workspace-data page-id :objects id] geom/resize-rect attr value))))) -(defn update-circle-dimensions - [id attr value] - (us/verify ::us/uuid id) - (us/verify #{:rx :ry} attr) - (us/verify ::us/number value) - (ptk/reify ::update-rect-dimensions - IBatchedChange - IUpdateGroup - (get-ids [_] [id]) - - ptk/UpdateEvent - (update [_ state] - (let [page-id (:current-page-id state)] - state - #_(update-in state [:workspace-data page-id :objects id] - geom/resize-circle attr value))))) - ;; --- Shape Proportions (defn toggle-shape-proportion-lock @@ -1650,7 +1633,7 @@ (filter #(selected (:old-id %))) (map #(get-in % [:obj :id])) (into #{}))] - (rx/of (common/commit-changes rchanges uchanges {:commit-local? true}) + (rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true}) (select-shapes selected)))))) (def paste @@ -1735,7 +1718,7 @@ :shapes (vec selected)} {:type :del-obj :id id}]] - (rx/of (common/commit-changes rchanges uchanges {:commit-local? true}) + (rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true}) (select-shapes #{id})))))))) (def remove-group @@ -1771,7 +1754,7 @@ :parent-id parent-id :shapes [group-id] :index index-in-parent}]] - (rx/of (common/commit-changes rchanges uchanges {:commit-local? true})))))))) + (rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Exports @@ -1806,10 +1789,10 @@ "shift+1" #(st/emit! reset-zoom) "shift+2" #(st/emit! zoom-to-200) "ctrl+d" #(st/emit! duplicate-selected) - "ctrl+z" #(st/emit! common/undo) - "ctrl+shift+z" #(st/emit! common/redo) - "ctrl+y" #(st/emit! common/redo) - "ctrl+q" #(st/emit! common/reinitialize-undo) + "ctrl+z" #(st/emit! dwc/undo) + "ctrl+shift+z" #(st/emit! dwc/redo) + "ctrl+y" #(st/emit! dwc/redo) + "ctrl+q" #(st/emit! dwc/reinitialize-undo) "ctrl+b" #(st/emit! (select-for-drawing :rect)) "ctrl+e" #(st/emit! (select-for-drawing :circle)) "ctrl+t" #(st/emit! (select-for-drawing :text)) diff --git a/frontend/src/uxbox/main/ui/workspace/sidebar/options/measures.cljs b/frontend/src/uxbox/main/ui/workspace/sidebar/options/measures.cljs index a6751b7f4..af16028ae 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/options/measures.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/options/measures.cljs @@ -60,14 +60,6 @@ (d/parse-integer 0))] (st/emit! (udw/update-rect-dimensions (:id shape) attr value)))) - on-circle-size-change - (fn [event attr] - (let [value (-> (dom/get-target event) - (dom/get-value) - (d/parse-integer 0) - (/ 2))] ; Convert back to radius before update - (st/emit! (udw/update-circle-dimensions (:id shape) attr value)))) - on-proportion-lock-change (fn [event] (st/emit! (udw/toggle-shape-proportion-lock (:id shape)))) @@ -101,9 +93,7 @@ on-width-change #(on-size-change % :width) on-height-change #(on-size-change % :height) on-pos-x-change #(on-position-change % :x) - on-pos-y-change #(on-position-change % :y) - on-size-rx-change #(on-circle-size-change % :rx) - on-size-ry-change #(on-circle-size-change % :ry)] + on-pos-y-change #(on-position-change % :y)] [:div.element-set [:div.element-set-content @@ -136,30 +126,6 @@ (d/coalesce 0) (math/round)))}]]]) - ;; Circle RX RY - (when (options :circle-size) - [:div.row-flex - [:span.element-set-subtitle (t locale "workspace.options.size")] - [:div.lock-size {:class (when (:proportion-lock shape) "selected") - :on-click on-proportion-lock-change} - (if (:proportion-lock shape) - i/lock - i/unlock)] - [:div.input-element.pixels - [:input.input-text {:type "number" - :min "0" - :on-change on-size-rx-change - :value (str (-> (* 2 (:rx shape)) ; Show to user diameter and not radius - (d/coalesce 0) - (math/round)))}]] - [:div.input-element.pixels - [:input.input-text {:type "number" - :min "0" - :on-change on-size-ry-change - :value (str (-> (* 2 (:ry shape)) - (d/coalesce 0) - (math/round)))}]]]) - ;; POSITION (when (options :position) [:div.row-flex