mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
🐛 Fix problem when pasting elements in reverse flex layout
Some checks failed
_DEVELOP / build-bundle (push) Has been cancelled
_DEVELOP / build-docker (push) Has been cancelled
_STAGING / build-bundle (push) Has been cancelled
_STAGING / build-docker (push) Has been cancelled
Commit Message Check / Check Commit Message (push) Has been cancelled
CI / Code Linter (push) Has been cancelled
CI / Common Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / Render WASM Tests (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Library Tests (push) Has been cancelled
CI / Build Integration Bundle (push) Has been cancelled
CI / Integration Tests 1/4 (push) Has been cancelled
CI / Integration Tests 2/4 (push) Has been cancelled
CI / Integration Tests 3/4 (push) Has been cancelled
Some checks failed
_DEVELOP / build-bundle (push) Has been cancelled
_DEVELOP / build-docker (push) Has been cancelled
_STAGING / build-bundle (push) Has been cancelled
_STAGING / build-docker (push) Has been cancelled
Commit Message Check / Check Commit Message (push) Has been cancelled
CI / Code Linter (push) Has been cancelled
CI / Common Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / Render WASM Tests (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Library Tests (push) Has been cancelled
CI / Build Integration Bundle (push) Has been cancelled
CI / Integration Tests 1/4 (push) Has been cancelled
CI / Integration Tests 2/4 (push) Has been cancelled
CI / Integration Tests 3/4 (push) Has been cancelled
This commit is contained in:
committed by
Andrey Antukh
parent
6611fbd13b
commit
c2014a37b4
@@ -13,6 +13,7 @@
|
|||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
- Fix problem when drag+duplicate a full grid [Taiga #12565](https://tree.taiga.io/project/penpot/issue/12565)
|
- Fix problem when drag+duplicate a full grid [Taiga #12565](https://tree.taiga.io/project/penpot/issue/12565)
|
||||||
|
- Fix problem when pasting elements in reverse flex layout [Taiga #12460](https://tree.taiga.io/project/penpot/issue/12460)
|
||||||
|
|
||||||
|
|
||||||
## 2.12.0 (Unreleased)
|
## 2.12.0 (Unreleased)
|
||||||
|
|||||||
@@ -706,12 +706,11 @@
|
|||||||
(= 1 (count tree-root)))]
|
(= 1 (count tree-root)))]
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
(selected-frame? state)
|
|
||||||
|
|
||||||
(if (or (any-same-frame-from-selected? state (keys pobjects))
|
|
||||||
(and only-one-root-shape?
|
|
||||||
(frame-same-size? pobjects (first tree-root))))
|
|
||||||
;; Paste next to selected frame, if selected is itself or of the same size as the copied
|
;; Paste next to selected frame, if selected is itself or of the same size as the copied
|
||||||
|
(and (selected-frame? state)
|
||||||
|
(or (any-same-frame-from-selected? state (keys pobjects))
|
||||||
|
(and only-one-root-shape?
|
||||||
|
(frame-same-size? pobjects (first tree-root)))))
|
||||||
(let [selected-frame-obj (get page-objects (first page-selected))
|
(let [selected-frame-obj (get page-objects (first page-selected))
|
||||||
parent-id (:parent-id base)
|
parent-id (:parent-id base)
|
||||||
paste-x (+ (:width selected-frame-obj) (:x selected-frame-obj) 50)
|
paste-x (+ (:width selected-frame-obj) (:x selected-frame-obj) 50)
|
||||||
@@ -721,6 +720,7 @@
|
|||||||
[parent-id delta index])
|
[parent-id delta index])
|
||||||
|
|
||||||
;; Paste inside selected frame otherwise
|
;; Paste inside selected frame otherwise
|
||||||
|
(selected-frame? state)
|
||||||
(let [selected-frame-obj (get page-objects (first page-selected))
|
(let [selected-frame-obj (get page-objects (first page-selected))
|
||||||
origin-frame-id (:frame-id first-selected-obj)
|
origin-frame-id (:frame-id first-selected-obj)
|
||||||
origin-frame-object (get page-objects origin-frame-id)
|
origin-frame-object (get page-objects origin-frame-id)
|
||||||
@@ -751,8 +751,13 @@
|
|||||||
;; - Align it to the limits on the x and y axis
|
;; - Align it to the limits on the x and y axis
|
||||||
;; - Respect the distance of the object to the right
|
;; - Respect the distance of the object to the right
|
||||||
;; and bottom in the original frame
|
;; and bottom in the original frame
|
||||||
(gpt/point paste-x paste-y))]
|
(gpt/point paste-x paste-y))
|
||||||
[frame-id delta (dec (count (:shapes selected-frame-obj)))]))
|
|
||||||
|
target-index
|
||||||
|
(if (and (ctl/flex-layout? selected-frame-obj) (ctl/reverse? selected-frame-obj))
|
||||||
|
(dec 0) ;; Before the first index 0
|
||||||
|
(count (:shapes selected-frame-obj)))]
|
||||||
|
[frame-id delta target-index])
|
||||||
|
|
||||||
(empty? page-selected)
|
(empty? page-selected)
|
||||||
(let [frame-id (ctst/top-nested-frame page-objects position)
|
(let [frame-id (ctst/top-nested-frame page-objects position)
|
||||||
|
|||||||
Reference in New Issue
Block a user