0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix ordering of copy+pasted shapes after rect select

This commit is contained in:
Andrés Moya 2021-04-28 16:24:57 +02:00 committed by Alonso Torres
parent 2974fb0f4e
commit c62905b9a8
3 changed files with 9 additions and 5 deletions

View file

@ -28,6 +28,7 @@
- Fix problem with pan and space [#811](https://github.com/penpot/penpot/issues/811)
- Fix issue when parsing exponential numbers in paths
- Remove legacy system user and team [#843](https://github.com/penpot/penpot/issues/843)
- Fix ordering of copy pasted objects [Taiga #1618](https://tree.taiga.io/project/penpot/issue/1617)
- Fix problems with blending modes [#837](https://github.com/penpot/penpot/issues/837)
- Fix problem with zoom an selection rect [#845](https://github.com/penpot/penpot/issues/845)
- Fix problem displaying team statistics [#859](https://github.com/penpot/penpot/issues/859)

View file

@ -100,7 +100,8 @@
{:cmd :selection/query
:page-id page-id
:rect rect
:include-frames? true}))))
:include-frames? true
:reverse? true})))) ;; we want the topmost shape to be selected first
;; We use ref so we don't recreate the stream on a change
transform-ref (mf/use-ref nil)

View file

@ -41,8 +41,8 @@
nil))
(defmethod impl/handler :selection/query
[{:keys [page-id rect frame-id include-frames? include-groups? disabled-masks] :or {include-groups? true
disabled-masks #{}} :as message}]
[{:keys [page-id rect frame-id include-frames? include-groups? disabled-masks reverse?]
:or {include-groups? true disabled-masks #{} reverse? false} :as message}]
(when-let [index (get @state page-id)]
(let [result (-> (qdt/search index (clj->js rect))
(es6-iterator-seq))
@ -76,11 +76,13 @@
(filter (comp overlaps? :frame))
(filter (comp overlaps-masks? :masks))
(filter overlaps?))
result)]
result)
keyfn (if reverse? (comp - :z) :z)]
(into (d/ordered-set)
(->> matching-shapes
(sort-by (comp - :z))
(sort-by keyfn)
(map :id))))))
(defn create-mask-index