diff --git a/CHANGES.md b/CHANGES.md index 0515b55b19..07b6d810ee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -25,8 +25,11 @@ - Fix style for team invite in deutsch [Taiga #4614](https://tree.taiga.io/project/penpot/issue/4614) - Fix problem with text edition in Safari [Taiga #4046](https://tree.taiga.io/project/penpot/issue/4046) - Fix show outline with rounded corners on rects [Taiga #4053](https://tree.taiga.io/project/penpot/issue/4053) +- Fix wrong interaction between comments and panning modes [Taiga #4297](https://tree.taiga.io/project/penpot/issue/4297) - Fix bad element positioning on interaction with fixed scroll [Github #2660](https://github.com/penpot/penpot/issues/2660) - Fix display type of component library not persistent [Taiga #4512](https://tree.taiga.io/project/penpot/issue/4512) +- Fix problem when moving texts with keyboard [#2690](https://github.com/penpot/penpot/issues/2690) +- Fix problem when drawing boxes won't detect mouse-up [Taiga #4618](https://tree.taiga.io/project/penpot/issue/4618) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/data/workspace/comments.cljs b/frontend/src/app/main/data/workspace/comments.cljs index 9c93ec83b1..571e59e1f1 100644 --- a/frontend/src/app/main/data/workspace/comments.cljs +++ b/frontend/src/app/main/data/workspace/comments.cljs @@ -38,6 +38,10 @@ (->> stream (rx/filter ms/mouse-click?) (rx/switch-map #(rx/take 1 ms/mouse-position)) + (rx/with-latest-from ms/keyboard-space) + (rx/tap prn) + (rx/filter (fn [[_ space]] (not space)) ) + (rx/map first) (rx/map handle-comment-layer-click) (rx/take-until stoper)) (->> stream diff --git a/frontend/src/app/main/data/workspace/drawing/box.cljs b/frontend/src/app/main/data/workspace/drawing/box.cljs index c586af8c4d..4c4c3346e0 100644 --- a/frontend/src/app/main/data/workspace/drawing/box.cljs +++ b/frontend/src/app/main/data/workspace/drawing/box.cljs @@ -94,19 +94,22 @@ (rx/of #(assoc-in state [:workspace-drawing :object] shape)) ;; Initial SNAP - (->> (snap/closest-snap-point page-id [shape] objects layout zoom focus initial) - (rx/map move-drawing)) + (->> + (rx/concat + (->> (snap/closest-snap-point page-id [shape] objects layout zoom focus initial) + (rx/map move-drawing)) - (->> ms/mouse-position - (rx/filter #(> (gpt/distance % initial) (/ 2 zoom))) - (rx/with-latest vector ms/mouse-position-shift) - (rx/switch-map - (fn [[point :as current]] - (->> (snap/closest-snap-point page-id [shape] objects layout zoom focus point) - (rx/map #(conj current %))))) - (rx/map - (fn [[_ shift? point]] - #(update-drawing % initial (cond-> point snap-pixel? gpt/round) shift?))) + (->> ms/mouse-position + (rx/filter #(> (gpt/distance % initial) (/ 2 zoom))) + (rx/with-latest vector ms/mouse-position-shift) + (rx/switch-map + (fn [[point :as current]] + (->> (snap/closest-snap-point page-id [shape] objects layout zoom focus point) + (rx/map #(conj current %))))) + (rx/map + (fn [[_ shift? point]] + #(update-drawing % initial (cond-> point snap-pixel? gpt/round) shift?))))) + (rx/take-until stoper)) - (rx/take-until stoper)) - (rx/of (common/handle-finish-drawing))))))) + (->> (rx/of (common/handle-finish-drawing)) + (rx/delay 100))))))) diff --git a/frontend/src/app/main/ui/comments.cljs b/frontend/src/app/main/ui/comments.cljs index 48281ae40e..d8d4513073 100644 --- a/frontend/src/app/main/ui/comments.cljs +++ b/frontend/src/app/main/ui/comments.cljs @@ -104,11 +104,17 @@ :on-blur on-blur :on-focus on-focus :on-change on-change}] - (when (or @show-buttons? - (seq @content)) + (when (or @show-buttons? (seq @content)) [:div.buttons - [:input.btn-primary {:type "button" :value "Post" :on-click on-submit :disabled (str/empty-or-nil? @content)}] - [:input.btn-secondary {:type "button" :value "Cancel" :on-click on-cancel}]])])) + [:input.btn-primary + {:type "button" + :value "Post" + :on-click on-submit + :disabled (str/empty-or-nil? @content)}] + [:input.btn-secondary + {:type "button" + :value "Cancel" + :on-click on-cancel}]])])) (mf/defc draft-thread [{:keys [draft zoom on-cancel on-submit position-modifier]}] diff --git a/frontend/src/app/main/ui/shapes/frame.cljs b/frontend/src/app/main/ui/shapes/frame.cljs index 54763d8faa..7b87e065f8 100644 --- a/frontend/src/app/main/ui/shapes/frame.cljs +++ b/frontend/src/app/main/ui/shapes/frame.cljs @@ -26,7 +26,7 @@ (mf/defc frame-clip-def [{:keys [shape render-id]}] - (when (= :frame (:type shape)) + (when (and (= :frame (:type shape)) (not (:show-content shape))) (let [{:keys [x y width height]} shape transform (gsh/transform-str shape) props (-> (attrs/extract-style-attrs shape) @@ -66,8 +66,7 @@ [:* [:g {:clip-path (when (not show-content) (frame-clip-url shape render-id))} - (when (not show-content) - [:& frame-clip-def {:shape shape :render-id render-id}]) + [:& frame-clip-def {:shape shape :render-id render-id}] [:& shape-fills {:shape shape} (if path? diff --git a/frontend/src/app/main/ui/workspace/shapes/frame.cljs b/frontend/src/app/main/ui/workspace/shapes/frame.cljs index 2ac96c6616..fd11a1e48b 100644 --- a/frontend/src/app/main/ui/workspace/shapes/frame.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/frame.cljs @@ -146,5 +146,5 @@ [:g.frame-thumbnail-wrapper {:id (dm/str "thumbnail-container-" (:id shape)) ;; Hide the thumbnail when not displaying - :opacity (when (and @rendered? (not thumbnail?) (not render-frame?)) 0)} + :opacity (when-not thumbnail? 0)} thumbnail-renderer]]]))))) diff --git a/frontend/src/app/main/ui/workspace/shapes/frame/dynamic_modifiers.cljs b/frontend/src/app/main/ui/workspace/shapes/frame/dynamic_modifiers.cljs index 21bef00465..84a023e7b7 100644 --- a/frontend/src/app/main/ui/workspace/shapes/frame/dynamic_modifiers.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/frame/dynamic_modifiers.cljs @@ -224,10 +224,9 @@ (mf/use-effect (mf/deps add-children) (fn [] - (doseq [{:keys [frame shape]} add-children-prev] - (let [frame-node (get-shape-node node frame) - shape-node (get-shape-node shape) - mirror-node (dom/query frame-node (dm/fmt ".mirror-shape[href='#shape-%'" shape))] + (doseq [{:keys [shape]} add-children-prev] + (let [shape-node (get-shape-node shape) + mirror-node (dom/query (dm/fmt ".mirror-shape[href='#shape-%'" shape))] (when mirror-node (.remove mirror-node)) (dom/remove-attribute! (dom/get-parent shape-node) "display"))) @@ -235,6 +234,9 @@ (let [frame-node (get-shape-node frame) shape-node (get-shape-node shape) + clip-id + (dom/get-attribute (dom/query frame-node ":scope > defs > .frame-clip-def") "id") + use-node (.createElementNS globals/document "http://www.w3.org/2000/svg" "use") @@ -242,6 +244,7 @@ (or (dom/query frame-node ".frame-children") frame-node)] (dom/set-attribute! use-node "href" (dm/fmt "#shape-%" shape)) + (dom/set-attribute! use-node "clip-path" (dm/fmt "url(#%)" clip-id)) (dom/add-class! use-node "mirror-shape") (dom/append-child! contents-node use-node) (dom/set-attribute! (dom/get-parent shape-node) "display" "none"))))) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs index b32b3dc06e..7658de6730 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs @@ -167,6 +167,10 @@ (or (and (not remote?) (not (text-properties-equal? old-shape new-shape))) + (and (not= new-modifiers old-modifiers) + (or (ctm/empty? new-modifiers) + (ctm/empty? old-modifiers))) + (and (not= new-modifiers old-modifiers) (or (not (ctm/only-move? new-modifiers)) (not (ctm/only-move? old-modifiers)))) diff --git a/frontend/src/app/main/ui/workspace/viewport/actions.cljs b/frontend/src/app/main/ui/workspace/viewport/actions.cljs index 70a66fd226..0bf2505fd2 100644 --- a/frontend/src/app/main/ui/workspace/viewport/actions.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/actions.cljs @@ -56,7 +56,7 @@ middle-click? (and (not panning) (= 2 (.-which event)))] (cond - middle-click? + (or middle-click? (and left-click? @space?)) (do (dom/prevent-default bevent) (if mod? @@ -85,15 +85,6 @@ (when-not workspace-read-only? (st/emit! (dwdp/handle-area-selection shift?))) - (and @space? mod?) - (let [raw-pt (dom/get-client-position event) - viewport (mf/ref-val viewport-ref) - pt (utils/translate-point-to-viewport viewport zoom raw-pt)] - (st/emit! (dw/start-zooming pt))) - - @space? - (st/emit! (dw/start-panning)) - drawing-tool (when-not workspace-read-only? (st/emit! (dd/start-drawing drawing-tool)))