Merge pull request #4700 from penpot/alotor-bugfix

Alotor bugfix
This commit is contained in:
Pablo Alba 2024-06-07 16:33:41 +02:00 committed by GitHub
commit d9618c6213
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 11 deletions

View file

@ -23,6 +23,8 @@
- Fix expand libraries when search results are present [Taiga #7876](https://tree.taiga.io/project/penpot/issue/7876) - Fix expand libraries when search results are present [Taiga #7876](https://tree.taiga.io/project/penpot/issue/7876)
- Fix color palette default library [Taiga #8029](https://tree.taiga.io/project/penpot/issue/8029) - Fix color palette default library [Taiga #8029](https://tree.taiga.io/project/penpot/issue/8029)
- Component Library is lost after exporting/importing in .zip format [Github #4672](https://github.com/penpot/penpot/issues/4672) - Component Library is lost after exporting/importing in .zip format [Github #4672](https://github.com/penpot/penpot/issues/4672)
- Fix problem with moving+selection not working properly [Taiga #7943](https://tree.taiga.io/project/penpot/issue/7943)
- Fix problem with flex layout fit to content not positioning correctly children [Taiga #7537](https://tree.taiga.io/project/penpot/issue/7537)
## 2.0.3 ## 2.0.3

View file

@ -269,6 +269,13 @@
(keep (mk-check-auto-layout objects)) (keep (mk-check-auto-layout objects))
shapes))) shapes)))
(defn full-tree?
"Checks if we need to calculate the full tree or we can calculate just a partial tree. Partial
trees are more efficient but cannot be done when the layout is centered."
[objects layout-id]
(let [layout-justify-content (get-in objects [layout-id :layout-justify-content])]
(contains? #{:center :end :space-around :space-evenly :stretch} layout-justify-content)))
(defn sizing-auto-modifiers (defn sizing-auto-modifiers
"Recalculates the layouts to adjust the sizing: auto new sizes" "Recalculates the layouts to adjust the sizing: auto new sizes"
[modif-tree sizing-auto-layouts objects bounds ignore-constraints] [modif-tree sizing-auto-layouts objects bounds ignore-constraints]
@ -286,7 +293,7 @@
(d/seek sizing-auto-layouts)) (d/seek sizing-auto-layouts))
shapes shapes
(if from-layout (if (and from-layout (not (full-tree? objects from-layout)))
(cgst/resolve-subtree from-layout layout-id objects) (cgst/resolve-subtree from-layout layout-id objects)
(cgst/resolve-tree #{layout-id} objects)) (cgst/resolve-tree #{layout-id} objects))

View file

@ -431,7 +431,7 @@
(watch [_ state stream] (watch [_ state stream]
(let [initial (deref ms/mouse-position) (let [initial (deref ms/mouse-position)
stopper (mse/drag-stopper stream) stopper (mse/drag-stopper stream {:interrupt? false})
zoom (get-in state [:workspace-local :zoom] 1) zoom (get-in state [:workspace-local :zoom] 1)
;; We toggle the selection so we don't have to wait for the event ;; We toggle the selection so we don't have to wait for the event

View file

@ -72,12 +72,20 @@
(defn drag-stopper (defn drag-stopper
"Creates a stream to stop drag events. Takes into account the mouse and also "Creates a stream to stop drag events. Takes into account the mouse and also
if the window loses focus or the esc key is pressed." if the window loses focus or the esc key is pressed."
[stream] ([stream]
(rx/merge (drag-stopper stream nil))
(->> stream ([stream {:keys [blur? up-mouse? interrupt?] :or {blur? true up-mouse? true interrupt? true}}]
(rx/filter blur-event?)) (rx/merge
(->> stream (if blur?
(rx/filter mouse-event?) (->> stream
(rx/filter mouse-up-event?)) (rx/filter blur-event?))
(->> stream (rx/empty))
(rx/filter #(= % :interrupt))))) (if up-mouse?
(->> stream
(rx/filter mouse-event?)
(rx/filter mouse-up-event?))
(rx/empty))
(if interrupt?
(->> stream
(rx/filter #(= % :interrupt)))
(rx/empty)))))