Repository navigation
lua: return absolute coordinates from PCSX.Helpers.UI.imageCoordinates - #2472
Conversation
Viewport scenes take ImGui coordinates, which are absolute when multi-viewports are enabled, and the renderer already offsets each viewport. Subtracting the viewport position here shifted every point by it. GetCursorScreenPos is the absolute cursor position, and also accounts for the window's scroll.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
tvg.getViewportScenepaints take ImGui coordinates, which are absolute with multi-viewports on. The renderer translates each viewport by minus its own position.imageCoordinatessubtracted the viewport position as well, so every point it returned was shifted by it. It now returnsGetCursorScreenPos()plus the scaled offset, which also stops ignoring the window's scroll (GetCursorPosadds it back).Measured under Xvfb with a window placed at (300, 200): with
-viewportsthe main viewport sat at (0, 112), the old helper returned (308, 118) and the absolute cursor was (308, 230). With-no-viewportsboth were (308, 230).