0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 18:48:37 -05:00

Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Alejandro Alonso 2023-02-28 10:53:09 +01:00
commit b73b40b23c
3 changed files with 121 additions and 83 deletions

View file

@ -20,6 +20,12 @@
- To @ondrejkonec: for contributing to the code with:
- Refactor CSS variables [Github #2948](https://github.com/penpot/penpot/pull/2948)
## 1.17.3
### :bug: Bugs fixed
- Fix copy and paste very nested inside itself [Taiga #4848](https://tree.taiga.io/project/penpot/issue/4848)
- Fix custom fonts not rendered correctly [Taiga #4874](https://tree.taiga.io/project/penpot/issue/4874)
## 1.17.2
### :bug: Bugs fixed
@ -29,10 +35,6 @@
- Fix correct behaviour for space-around and added space-evenly option
- Fix duplicate with alt and undo only undo one step [Taiga #4746](https://tree.taiga.io/project/penpot/issue/4746)
- Fix problem creating frames inside layout [Taiga #4844](https://tree.taiga.io/project/penpot/issue/4844)
## 1.17.2
### :bug: Bugs fixed
- Fix paste board inside itself [Taiga #4775](https://tree.taiga.io/project/penpot/issue/4775)
- Fix middle button panning can drag guides [Taiga #4266](https://tree.taiga.io/project/penpot/issue/4266)

View file

@ -177,12 +177,20 @@
(watch [_ _ stream]
(let [team-id (:team-id project)
stoper (rx/filter (ptk/type? ::bundle-fetched) stream)]
(->> (rx/merge
;; Initialize notifications & load team fonts
(->> (rx/concat
;; Initialize notifications
(rx/of (dwn/initialize team-id id)
(dwsl/initialize)
(df/load-team-fonts team-id))
(dwsl/initialize))
;; Load team fonts. We must ensure custom fonts are fully loadad before starting the workspace load
(rx/merge
(->> stream
(rx/filter (ptk/type? :app.main.data.fonts/team-fonts-loaded))
(rx/take 1)
(rx/ignore))
(rx/of (df/load-team-fonts team-id)))
(rx/merge
;; Load all pages, independently if they are pointers or already
;; resolved values.
(->> (rx/from (seq (:pages-index data)))
@ -226,7 +234,7 @@
(resolve-pointers id)
(rx/map #(update file :data merge %)))))
(rx/reduce conj [])
(rx/map libraries-fetched)))))))
(rx/map libraries-fetched))))))))
(rx/take-until stoper)))))))
@ -1444,9 +1452,17 @@
(and (= 1 (count selected))
(= :frame (get-in objects [(first selected) :type])))))
(defn same-frame-from-selected? [state frame-id]
(let [selected (wsh/lookup-selected state)]
(contains? frame-id (first selected))))
(defn get-tree-root-shapes [tree]
;; This fn gets a map of shapes and finds what shapes are parent of the rest
(let [shapes-in-tree (vals tree)
shape-ids (keys tree)
parent-ids (set (map #(:parent-id %) shapes-in-tree))]
(->> shape-ids
(filter #(contains? parent-ids %)))))
(defn any-same-frame-from-selected? [state frame-ids]
(let [selected (first (wsh/lookup-selected state))]
(< 0 (count (filter #(= % selected) frame-ids)))))
(defn frame-same-size?
[paste-obj frame-obj]
@ -1504,13 +1520,18 @@
frame-id (first page-selected)
frame-object (get page-objects frame-id)
base (cph/get-base-shape page-objects page-selected)
index (cph/get-position-on-parent page-objects (:id base))]
index (cph/get-position-on-parent page-objects (:id base))
tree-root (get-tree-root-shapes paste-objects)
only-one-root-shape? (and
(< 1 (count paste-objects))
(= 1 (count tree-root)))]
(cond
(selected-frame? state)
(if (or (same-frame-from-selected? state (first (vals paste-objects)))
(frame-same-size? paste-objects frame-object))
(if (or (any-same-frame-from-selected? state (keys paste-objects))
(and only-one-root-shape?
(frame-same-size? paste-objects (first tree-root))))
;; Paste next to selected frame, if selected is itself or of the same size as the copied
(let [selected-frame-obj (get page-objects (first page-selected))
parent-id (:parent-id base)
@ -1548,6 +1569,7 @@
;; - Respect the distance of the object to the right and bottom in the original frame
(gpt/point paste-x paste-y))]
[frame-id frame-id delta]))
(empty? page-selected)
(let [frame-id (ctst/top-nested-frame page-objects mouse-pos)
delta (gpt/subtract mouse-pos orig-pos)]

View file

@ -236,6 +236,13 @@
(-> shape
(assoc :layout-item-h-sizing :auto
:layout-item-v-sizing :auto))))
;; Set the children to fixed to remove strange interactions
(dwc/update-shapes
selected
(fn [shape]
(-> shape
(assoc :layout-item-h-sizing :fix
:layout-item-v-sizing :fix))))
(ptk/data-event :layout/update [new-shape-id])
(dws/delete-shapes page-id selected)
@ -257,6 +264,13 @@
(merge flex-params)
(assoc :layout-item-h-sizing :auto
:layout-item-v-sizing :auto))))
;; Set the children to fixed to remove strange interactions
(dwc/update-shapes
selected
(fn [shape]
(-> shape
(assoc :layout-item-h-sizing :fix
:layout-item-v-sizing :fix))))
(ptk/data-event :layout/update [new-shape-id])
(dwu/commit-undo-transaction undo-id))))))))