Skip to content

Commit 07163d0

Browse files
authored
Merge pull request #174 from kenmcgaugh/hidpi_pointer_select_media
Fix pointer_select_media() on HiDPI device
2 parents 91d2334 + ee0b3b8 commit 07163d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ui/viewport/src/viewport.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,15 +2202,18 @@ void Viewport::pointer_select_media(const PointerEvent &pointer_event) {
22022202
// lazy!
22032203
thread_local utility::Uuid last_im_id;
22042204

2205+
const auto pointer_x = pointer_event.x() / state_.devicePixelRatio_;
2206+
const auto pointer_y = pointer_event.y() / state_.devicePixelRatio_;
2207+
22052208
// lreverse oop through image bounds (last one is drawn on-top)
22062209
// these are the images visible in the layout
22072210
for (int i = (int(image_bounds_in_viewport_pixels_.size()) - 1); i >= 0; --i) {
22082211

22092212
const auto &im_bounds = image_bounds_in_viewport_pixels_[i];
22102213

22112214
// is the mouse inside the image boundary?
2212-
if (im_bounds.min.x <= pointer_event.x() && im_bounds.max.x >= pointer_event.x() &&
2213-
im_bounds.min.y <= pointer_event.y() && im_bounds.max.y >= pointer_event.y()) {
2215+
if (im_bounds.min.x <= pointer_x && im_bounds.max.x >= pointer_x &&
2216+
im_bounds.min.y <= pointer_y && im_bounds.max.y >= pointer_y) {
22142217

22152218
// .. yes. send the corresponding media UUID to the playhead
22162219

0 commit comments

Comments
 (0)