mirror of
https://github.com/penpot/penpot.git
synced 2025-07-22 09:57:14 +02:00
🐛 Fix dropdown being cut off
This commit is contained in:
parent
08c8b938ae
commit
b9b66aee85
3 changed files with 33 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
|||
cljs.core/IDeref
|
||||
(-deref [it] (.getBrowserEvent it)))
|
||||
|
||||
(declare get-window-size)
|
||||
|
||||
(defn browser-event?
|
||||
[o]
|
||||
|
@ -411,6 +412,19 @@
|
|||
:width (.-width ^js rect)
|
||||
:height (.-height ^js rect)}))
|
||||
|
||||
(defn is-bounding-rect-outside?
|
||||
[rect]
|
||||
(let [{:keys [left top right bottom]} rect
|
||||
{:keys [width height]} (get-window-size)]
|
||||
(or (< left 0)
|
||||
(< top 0)
|
||||
(> right width)
|
||||
(> bottom height))))
|
||||
|
||||
(defn is-element-outside?
|
||||
[element]
|
||||
(is-bounding-rect-outside? (get-bounding-rect element)))
|
||||
|
||||
(defn bounding-rect->rect
|
||||
[rect]
|
||||
(when (some? rect)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue