0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

Merge pull request #4724 from penpot/palba-fix-open-overlay-self

🐛 Fix open overlay relative to a frame
This commit is contained in:
Alejandro 2024-06-13 06:34:14 +02:00 committed by GitHub
commit 5c1e7adf7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 6 deletions

View file

@ -42,6 +42,7 @@
- Fix internal error when I set up a stroke for some objects without and with stroke [Taiga #7558](https://tree.taiga.io/project/penpot/issue/7558) - Fix internal error when I set up a stroke for some objects without and with stroke [Taiga #7558](https://tree.taiga.io/project/penpot/issue/7558)
- Toolbar keeps toggling on and off on spacebar press [Taiga #7654](https://github.com/penpot/penpot/pull/7654) - Toolbar keeps toggling on and off on spacebar press [Taiga #7654](https://github.com/penpot/penpot/pull/7654)
- Fix toolbar keeps hiding when click outside workspace [Taiga #7776](https://tree.taiga.io/project/penpot/issue/7776) - Fix toolbar keeps hiding when click outside workspace [Taiga #7776](https://tree.taiga.io/project/penpot/issue/7776)
- Fix open overlay relative to a frame [Taiga #7563](https://tree.taiga.io/project/penpot/issue/7563)
## 2.0.3 ## 2.0.3

View file

@ -44,9 +44,17 @@
(or (empty? overlays-ids) (nil? shape) (cfh/root? shape)) base-frame (or (empty? overlays-ids) (nil? shape) (cfh/root? shape)) base-frame
:else (find-relative-to-base-frame (cfh/get-parent objects (:id shape)) objects overlays-ids base-frame))) :else (find-relative-to-base-frame (cfh/get-parent objects (:id shape)) objects overlays-ids base-frame)))
(defn- ignore-frame-shape
[shape objects manual?]
(let [shape (cond-> shape ;; When the the interaction is not manual and its origin is a frame,
;; we need to ignore it on all the find-frame calculations
(and (:frame-id shape) (not manual?))
(assoc :type :rect))
objects (assoc objects (:id shape) shape)]
[shape objects]))
(defn- activate-interaction (defn- activate-interaction
[interaction shape base-frame frame-offset objects overlays] [interaction shape base-frame frame-offset objects overlays]
(case (:action-type interaction) (case (:action-type interaction)
:navigate :navigate
(when-let [frame-id (:destination interaction)] (when-let [frame-id (:destination interaction)]
@ -58,9 +66,11 @@
(dv/go-to-frame frame-id (:animation interaction))))) (dv/go-to-frame frame-id (:animation interaction)))))
:open-overlay :open-overlay
(let [dest-frame-id (:destination interaction) (let [manual? (= :manual (:overlay-pos-type interaction))
[shape objects] (ignore-frame-shape shape objects manual?)
dest-frame-id (:destination interaction)
dest-frame (get objects dest-frame-id) dest-frame (get objects dest-frame-id)
relative-to-id (if (= :manual (:overlay-pos-type interaction)) relative-to-id (if manual?
(if (= (:type shape) :frame) ;; manual interactions are always from "self" (if (= (:type shape) :frame) ;; manual interactions are always from "self"
(:frame-id shape) (:frame-id shape)
(:id shape)) (:id shape))
@ -88,7 +98,9 @@
fixed-base?)))) fixed-base?))))
:toggle-overlay :toggle-overlay
(let [dest-frame-id (:destination interaction) (let [manual? (= :manual (:overlay-pos-type interaction))
[shape objects] (ignore-frame-shape shape objects manual?)
dest-frame-id (:destination interaction)
dest-frame (get objects dest-frame-id) dest-frame (get objects dest-frame-id)
relative-to-id (if (= :manual (:overlay-pos-type interaction)) relative-to-id (if (= :manual (:overlay-pos-type interaction))
(if (= (:type shape) :frame) ;; manual interactions are always from "self" (if (= (:type shape) :frame) ;; manual interactions are always from "self"
@ -146,7 +158,9 @@
(st/emit! (dv/close-overlay frame-id))) (st/emit! (dv/close-overlay frame-id)))
:toggle-overlay :toggle-overlay
(let [dest-frame-id (:destination interaction) (let [manual? (= :manual (:overlay-pos-type interaction))
[shape objects] (ignore-frame-shape shape objects manual?)
dest-frame-id (:destination interaction)
dest-frame (get objects dest-frame-id) dest-frame (get objects dest-frame-id)
relative-to-id (if (= :manual (:overlay-pos-type interaction)) relative-to-id (if (= :manual (:overlay-pos-type interaction))
(if (= (:type shape) :frame) ;; manual interactions are always from "self" (if (= (:type shape) :frame) ;; manual interactions are always from "self"
@ -178,7 +192,9 @@
:close-overlay :close-overlay
(let [dest-frame-id (:destination interaction) (let [manual? (= :manual (:overlay-pos-type interaction))
[shape objects] (ignore-frame-shape shape objects manual?)
dest-frame-id (:destination interaction)
dest-frame (get objects dest-frame-id) dest-frame (get objects dest-frame-id)
relative-to-id (if (= :manual (:overlay-pos-type interaction)) relative-to-id (if (= :manual (:overlay-pos-type interaction))
(if (= (:type shape) :frame) ;; manual interactions are always from "self" (if (= (:type shape) :frame) ;; manual interactions are always from "self"