|
174 | 174 | (if (< o 0)
|
175 | 175 | (max o (- m))
|
176 | 176 | (min o m)))
|
| 177 | + apply-zoom-factor (fn [rect zoomed-container] |
| 178 | + (if-let [zn (.getElementById js/document zoomed-container)] |
| 179 | + (let [zoom (.-zoom (.getComputedStyle js/window zn ""))] |
| 180 | + (merge rect {:top (* (:top rect) zoom) |
| 181 | + :left (* (:left rect) zoom) |
| 182 | + :bottom (* (:bottom rect) zoom) |
| 183 | + :right (* (:right rect) zoom) |
| 184 | + :width (* (:width rect) zoom) |
| 185 | + :height (* (:height rect) zoom)})) |
| 186 | + rect)) |
177 | 187 | wz (window-size)
|
178 |
| - trect (if coordinates |
179 |
| - {:top (:y coordinates) |
180 |
| - :bottom (+ (:y coordinates) 1) |
181 |
| - :left (:x coordinates) |
182 |
| - :right (+ (:x coordinates) 1) |
183 |
| - :width 1 |
184 |
| - :height 1} |
185 |
| - (first (client-rects target))) |
| 188 | + trect (-> (if coordinates |
| 189 | + {:top (:y coordinates) |
| 190 | + :bottom (+ (:y coordinates) 1) |
| 191 | + :left (:x coordinates) |
| 192 | + :right (+ (:x coordinates) 1) |
| 193 | + :width 1 |
| 194 | + :height 1} |
| 195 | + (first (client-rects target))) |
| 196 | + (cond-> (:zoomed-container opts) |
| 197 | + (apply-zoom-factor (:zoomed-container opts)))) |
186 | 198 | target-pos (merge trect
|
187 | 199 | {:top (+ (:top trect) (:scroll-y wz))
|
188 | 200 | :bottom (+ (:bottom trect) (:scroll-y wz))
|
|
251 | 263 |
|
252 | 264 | om/IRenderState
|
253 | 265 | (render-state [this {:keys [label side has-arrow content-fn mouse-down] :as state}]
|
| 266 | + |
254 | 267 | (html
|
255 | 268 | [:div {:class (str "om-widgets-popover " (name side) " " (:popover-class opts))}
|
256 | 269 | (when (:mouse-down opts)
|
|
278 | 291 | :has-arrow (:has-arrow opts)
|
279 | 292 | :mouse-down #(om/set-state! owner :visible false)
|
280 | 293 | :popover-class (:popover-class opts)
|
| 294 | + :zoomed-container (:zoomed-container opts) |
281 | 295 | :close-fn #(go
|
282 | 296 | (<! (timeout 10))
|
283 | 297 | (om/set-state! owner :visible false))}})))
|
|
312 | 326 | :opts {:align (:align opts)
|
313 | 327 | :has-arrow (:has-arrow opts)
|
314 | 328 | :mouse-down #(om/set-state! owner :visible false)
|
| 329 | + :zoomed-container (:zoomed-container opts) |
315 | 330 | :popover-class (:popover-class opts)
|
316 | 331 | :close-fn #(go
|
317 | 332 | (<! (timeout 10))
|
|
336 | 351 | has-arrow
|
337 | 352 | popover-class
|
338 | 353 | launcher-class-name
|
| 354 | + zoomed-container |
339 | 355 | channel
|
340 | 356 | align
|
341 | 357 | visible
|
|
358 | 374 | :coordinates coordinates}
|
359 | 375 | :opts {:for for
|
360 | 376 | :has-arrow has-arrow
|
| 377 | + :zoomed-container zoomed-container |
| 378 | + |
361 | 379 | :popover-class popover-class
|
362 | 380 | :launcher-class-name launcher-class-name
|
363 | 381 | :align align}})
|
|
373 | 391 | :coordinates coordinates}
|
374 | 392 | :opts {:align align
|
375 | 393 | :popover-class popover-class
|
| 394 | + :zoomed-container zoomed-container |
376 | 395 | :launcher-class-name launcher-class-name
|
377 | 396 | :has-arrow has-arrow}})))
|
0 commit comments