diff --git a/frontend/src/uxbox/main/data/workspace.cljs b/frontend/src/uxbox/main/data/workspace.cljs index 31a4b0fb5..2d03d7ad6 100644 --- a/frontend/src/uxbox/main/data/workspace.cljs +++ b/frontend/src/uxbox/main/data/workspace.cljs @@ -1296,21 +1296,29 @@ (ptk/reify ::move-create-interaction ptk/UpdateEvent (update [_ state] - (if (= position initial-pos) - state - (assoc-in state [:workspace-local :draw-interaction-to] position))))) + (let [page-id (:current-page-id state) + objects (get-in state [:workspace-data page-id :objects]) + selected-shape-id (-> state (get-in [:workspace-local :selected]) first) + selected-shape (get objects selected-shape-id) + selected-shape-frame-id (:frame-id selected-shape) + start-frame (get objects selected-shape-frame-id) + end-frame (dwc/get-frame-at-point objects position)] + (cond-> state + (not= position initial-pos) (assoc-in [:workspace-local :draw-interaction-to] position) + (not= start-frame end-frame) (assoc-in [:workspace-local :draw-interaction-to-frame] end-frame)))))) (defn finish-create-interaction [initial-pos] (ptk/reify ::finish-create-interaction ptk/UpdateEvent (update [_ state] - (assoc-in state [:workspace-local :draw-interaction-to] nil)) + (-> state + (assoc-in [:workspace-local :draw-interaction-to] nil) + (assoc-in [:workspace-local :draw-interaction-to-frame] nil))) ptk/WatchEvent (watch [_ state stream] (let [position @ms/mouse-position - page-id (:current-page-id state) objects (get-in state [:workspace-data page-id :objects]) frame (dwc/get-frame-at-point objects position) diff --git a/frontend/src/uxbox/main/ui/workspace/shapes/interactions.cljs b/frontend/src/uxbox/main/ui/workspace/shapes/interactions.cljs index a042c2f7d..08ecb273f 100644 --- a/frontend/src/uxbox/main/ui/workspace/shapes/interactions.cljs +++ b/frontend/src/uxbox/main/ui/workspace/shapes/interactions.cljs @@ -19,7 +19,8 @@ [uxbox.main.store :as st] [uxbox.main.refs :as refs] [uxbox.main.data.workspace :as dw] - [uxbox.main.ui.keyboard :as kbd])) + [uxbox.main.ui.keyboard :as kbd] + [uxbox.main.ui.workspace.shapes.outline :refer [outline]])) (defn- get-click-interaction [shape] @@ -154,7 +155,10 @@ [:& interaction-marker {:x dest-x :y dest-y :arrow-dir arrow-dir - :zoom zoom}]]))) + :zoom zoom}] + + (when dest-shape + [:& outline {:shape dest-shape}])]))) (mf/defc interaction-handle @@ -179,6 +183,7 @@ active-shapes (filter #(first (get-click-interaction %)) (vals objects)) selected-shapes (map #(get objects %) selected) draw-interaction-to (:draw-interaction-to local) + draw-interaction-to-frame (:draw-interaction-to-frame local) first-selected (first selected-shapes)] [:* (for [shape active-shapes] @@ -197,6 +202,7 @@ [:& interaction-path {:key "interactive" :orig-shape first-selected :dest-point draw-interaction-to + :dest-shape draw-interaction-to-frame :selected? true :zoom zoom}] diff --git a/frontend/src/uxbox/main/ui/workspace/shapes/outline.cljs b/frontend/src/uxbox/main/ui/workspace/shapes/outline.cljs index ee56f15b0..f1683b94f 100644 --- a/frontend/src/uxbox/main/ui/workspace/shapes/outline.cljs +++ b/frontend/src/uxbox/main/ui/workspace/shapes/outline.cljs @@ -30,8 +30,8 @@ common {:fill "transparent" :stroke "#31EFB8" - :stroke-width "1px" - :pointer-events "none" + :strokeWidth "1px" + :pointerEvents "none" :transform transform} props (case (:type shape)