🐛 Fix dropdown being cut off

This commit is contained in:
Aitor 2024-02-09 15:33:13 +01:00 committed by Alonso Torres
parent 08c8b938ae
commit b9b66aee85
3 changed files with 33 additions and 1 deletions

View file

@ -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)