Use the last valid mouse position for VideoDisplay::GetMousePosition
On Windows opening the context menu triggers a mouse leave event, which invalidates the current mouse position, so the Copy coordinates to Clipboard command didn't work.
This commit is contained in:
parent
fd447927d5
commit
09962a56d1
2 changed files with 3 additions and 3 deletions
|
@ -351,7 +351,7 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
|
|||
if (event.ButtonDown())
|
||||
SetFocus();
|
||||
|
||||
mouse_pos = event.GetPosition();
|
||||
last_mouse_pos = mouse_pos = event.GetPosition();
|
||||
|
||||
if (tool)
|
||||
tool->OnMouseEvent(event);
|
||||
|
@ -424,7 +424,7 @@ bool VideoDisplay::ToolIsType(std::type_info const& type) const {
|
|||
}
|
||||
|
||||
Vector2D VideoDisplay::GetMousePosition() const {
|
||||
return mouse_pos ? tool->ToScriptCoords(mouse_pos) : mouse_pos;
|
||||
return last_mouse_pos ? tool->ToScriptCoords(last_mouse_pos) : last_mouse_pos;
|
||||
}
|
||||
|
||||
void VideoDisplay::Unload() {
|
||||
|
|
|
@ -83,7 +83,7 @@ class VideoDisplay : public wxGLCanvas {
|
|||
/// be the same as the actual client size of the display
|
||||
wxSize videoSize;
|
||||
|
||||
Vector2D mouse_pos;
|
||||
Vector2D last_mouse_pos, mouse_pos;
|
||||
|
||||
/// Screen pixels between the left of the canvas and the left of the video
|
||||
int viewport_left;
|
||||
|
|
Loading…
Reference in a new issue