diff --git a/CHANGES.md b/CHANGES.md index 06519684b..07b6d810e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,7 @@ - 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/drawing/box.cljs b/frontend/src/app/main/data/workspace/drawing/box.cljs index c586af8c4..4c4c3346e 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)))))))