diff --git a/CHANGES.md b/CHANGES.md index a06a37d4c..9acc1d8c0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,8 @@ ### :sparkles: New features -- Colorpicker: remember last color mode [Taiga #5508](https://tree.taiga.io/project/penpot/issue/5508) +- Remember last color mode in colorpicker [Taiga #5508](https://tree.taiga.io/project/penpot/issue/5508) +- Improve layers multiselection behaviour [Github #5741](https://github.com/penpot/penpot/issues/5741) ### :bug: Bugs fixed diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 6cb8c1237..dd2a881fa 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -122,7 +122,9 @@ (ptk/reify ::select-shape ptk/UpdateEvent (update [_ state] - (update-in state [:workspace-local :selected] d/toggle-selection id toggle?)) + (-> state + (update-in [:workspace-local :selected] d/toggle-selection id toggle?) + (assoc-in [:workspace-local :last-selected] id))) ptk/WatchEvent (watch [_ state _] @@ -185,7 +187,9 @@ (ptk/reify ::deselect-shape ptk/UpdateEvent (update [_ state] - (update-in state [:workspace-local :selected] disj id)))) + (-> state + (update-in [:workspace-local :selected] disj id) + (update :workspace-local dissoc :last-selected))))) (defn shift-select-shapes ([id] @@ -196,12 +200,14 @@ ptk/UpdateEvent (update [_ state] (let [objects (or objects (wsh/lookup-page-objects state)) + append-to-selection (cph/expand-region-selection objects (into #{} [(get-in state [:workspace-local :last-selected]) id])) selection (-> state wsh/lookup-selected (conj id))] (-> state (assoc-in [:workspace-local :selected] - (cph/expand-region-selection objects selection)))))))) + (set/union selection append-to-selection)) + (update :workspace-local assoc :last-selected id))))))) (defn select-shapes [ids]