From 75f8b04fa84d8a598e0b221535eb8f3b4009a543 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 4 Jun 2020 13:14:00 +0200 Subject: [PATCH 1/3] :bug: Grid options disalignment --- .../styles/main/partials/sidebar-element-options.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/resources/styles/main/partials/sidebar-element-options.scss b/frontend/resources/styles/main/partials/sidebar-element-options.scss index 183a68e61..c19d590e6 100644 --- a/frontend/resources/styles/main/partials/sidebar-element-options.scss +++ b/frontend/resources/styles/main/partials/sidebar-element-options.scss @@ -434,6 +434,10 @@ } } +.grid-option .custom-select { + margin-bottom: 0; +} + .color-th { background-color: $color-gray-10; border: 1px solid $color-gray-10; From e17ab24e664feaf7879044946d596a92081902ef Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 4 Jun 2020 13:14:12 +0200 Subject: [PATCH 2/3] :bug: Change absolute position to elements --- .../ui/workspace/sidebar/options/frame.cljs | 11 ++--- .../workspace/sidebar/options/measures.cljs | 41 ++++--------------- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/frontend/src/uxbox/main/ui/workspace/sidebar/options/frame.cljs b/frontend/src/uxbox/main/ui/workspace/sidebar/options/frame.cljs index 3306c0ea7..93bcba649 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/options/frame.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/options/frame.cljs @@ -60,15 +60,10 @@ (fn [event attr] (let [cval (-> (dom/get-target event) (dom/get-value) - (d/parse-integer)) - pval (get shape attr) - delta (if (= attr :x) - (gpt/point (math/neg (- pval cval)) 0) - (gpt/point 0 (math/neg (- pval cval))))] - + (d/parse-integer 0))] ;; TODO: Change so not apply the modifiers until blur - (st/emit! (udw/set-modifiers #{(:id shape)} {:displacement delta}) - (udw/apply-modifiers #{(:id shape)})))) + (when cval + (st/emit! (udw/update-position (:id shape) {attr cval}))))) on-width-change #(on-size-change % :width) on-height-change #(on-size-change % :height) 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 9cca409b2..7d6ecb6a2 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/options/measures.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/options/measures.cljs @@ -23,28 +23,6 @@ ;; -- User/drawing coords -(defn user-coords-vector - [shape] - (let [oldselrec (-> shape gsh/shape->path (gsh/center-transform (:transform shape)) gsh/shape->rect-shape) - {sel-x :x sel-y :y :as selrec} #_(:selrect shape) oldselrec - {rec-x :x rec-y :y} (-> shape gsh/shape->rect-shape) - dx (- rec-x sel-x) - dy (- rec-y sel-y)] - (-> (gpt/point dx dy) - (gpt/round 2)))) - -(defn user->draw - [{:keys [x y width height] :as shape}] - (let [dv (user-coords-vector shape)] - (-> shape - (gsh/move dv)))) - -(defn draw->user - [{:keys [x y width height] :as shape}] - (let [dv (user-coords-vector shape)] - (-> shape - (gsh/move (gpt/negate dv))))) - (mf/defc measures-menu [{:keys [shape options] :as props}] (let [options (or options #{:size :position :rotation :radius}) @@ -52,8 +30,7 @@ frame (deref (refs/object-by-id (:frame-id shape))) old-shape shape shape (->> shape - (gsh/transform-shape frame) - (draw->user)) + (gsh/transform-shape frame)) on-size-change (fn [event attr] @@ -70,12 +47,12 @@ (fn [event attr] (let [value (-> (dom/get-target event) (dom/get-value) - (d/parse-integer 0)) - new-shape (-> shape - (assoc attr value) - (gsh/translate-from-frame frame) - (user->draw))] - (st/emit! (udw/update-position (:id shape) (select-keys new-shape [attr]))))) + (d/parse-integer 0))] + (when value + (let [from (-> shape :selrect attr) + to (+ value (attr frame)) + target (+ (attr shape) (- to from))] + (st/emit! (udw/update-position (:id shape) {attr target})))))) on-rotation-change (fn [event] @@ -137,13 +114,13 @@ :type "number" :no-validate true :on-change on-pos-x-change - :value (-> shape :x (math/precision 2))}]] + :value (-> shape :selrect :x (math/precision 2))}]] [:div.input-element.Yaxis [:input.input-text {:placeholder "y" :type "number" :no-validate true :on-change on-pos-y-change - :value (-> shape :y (math/precision 2))}]]]) + :value (-> shape :selrect :y (math/precision 2))}]]]) (when (options :rotation) [:div.row-flex From 6e8cdd764a9ae719d1258b11cce919e3196d8117 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 4 Jun 2020 13:33:22 +0200 Subject: [PATCH 3/3] :bug: Fixes problem with closing paths --- frontend/src/uxbox/main/data/workspace/drawing.cljs | 2 +- frontend/src/uxbox/main/ui/workspace/drawarea.cljs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/uxbox/main/data/workspace/drawing.cljs b/frontend/src/uxbox/main/data/workspace/drawing.cljs index a5c5e9186..3f053f749 100644 --- a/frontend/src/uxbox/main/data/workspace/drawing.cljs +++ b/frontend/src/uxbox/main/data/workspace/drawing.cljs @@ -130,7 +130,7 @@ (def handle-drawing-path (letfn [(stoper-event? [{:keys [type shift] :as event}] - (or (= event ::end-path-drawing) + (or (= event :path/end-path-drawing) (and (ms/mouse-event? event) (or (and (= type :double-click) shift) (= type :context-menu))) diff --git a/frontend/src/uxbox/main/ui/workspace/drawarea.cljs b/frontend/src/uxbox/main/ui/workspace/drawarea.cljs index eac83bfad..a0dd0bcfc 100644 --- a/frontend/src/uxbox/main/ui/workspace/drawarea.cljs +++ b/frontend/src/uxbox/main/ui/workspace/drawarea.cljs @@ -47,7 +47,7 @@ (dom/stop-propagation event) (st/emit! (dw/assign-cursor-tooltip nil) dd/close-drawing-path - ::end-path-drawing)) + :path/end-path-drawing)) on-mouse-enter (fn [event]