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

🐛 Fix relative position overlay positioning

This commit is contained in:
alonso.torres 2023-03-30 15:51:01 +02:00
parent 0c8d8d92ba
commit 532caea169
2 changed files with 73 additions and 63 deletions

View file

@ -74,6 +74,7 @@
- Fix dashboard scrolling using 'Page Up' and 'Page Down' [Taiga #5081](https://tree.taiga.io/project/penpot/issue/5081)
- Fix view mode header buttons overlapping in small resolutions [Taiga #5058](https://tree.taiga.io/project/penpot/issue/5058)
- Fix precision for wrap in flex [Taiga #5072](https://tree.taiga.io/project/penpot/issue/5072)
- Fix relative position overlay positioning [Taiga #5092](https://tree.taiga.io/project/penpot/issue/5092)
### :heart: Community contributions by (Thank you!)
- To @ondrejkonec: for contributing to the code with:

View file

@ -7,6 +7,7 @@
(ns app.main.ui.viewer.shapes
"The main container for a frame in viewer mode"
(:require
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as gsh]
[app.common.pages.helpers :as cph]
[app.common.types.shape.interactions :as ctsi]
@ -46,6 +47,14 @@
(defn- activate-interaction
[interaction shape base-frame frame-offset objects overlays]
(let [;; When the interactive item is inside a nested frame we need to add to the offset the position
;; of the parent-frame otherwise the position won't match
shape-frame (cph/get-frame objects shape)
frame-offset (if (or (cph/root-frame? shape-frame) (cph/root? shape-frame))
frame-offset
(gpt/add frame-offset (gpt/point shape-frame)))]
(case (:action-type interaction)
:navigate
(when-let [frame-id (:destination interaction)]
@ -119,7 +128,7 @@
:open-url
(st/emit! (dom/open-new-window (:url interaction)))
nil))
nil)))
;; Perform the opposite action of an interaction, if possible
(defn- deactivate-interaction