[fix] fix cursor mapping

This commit is contained in:
dijunkun
2025-04-14 16:59:48 +08:00
parent 2774991107
commit dce32672a6

View File

@@ -54,8 +54,6 @@ int Render::ProcessMouseEvent(SDL_Event &event) {
event.button.y <= event.button.y <=
props->stream_render_rect_.y + props->stream_render_rect_.h) { props->stream_render_rect_.y + props->stream_render_rect_.h) {
controlled_remote_id_ = it.first; controlled_remote_id_ = it.first;
video_width = props->video_width_;
video_height = props->video_height_;
render_width = props->stream_render_rect_.w; render_width = props->stream_render_rect_.w;
render_height = props->stream_render_rect_.h; render_height = props->stream_render_rect_.h;
@@ -65,8 +63,10 @@ int Render::ProcessMouseEvent(SDL_Event &event) {
(float)props->original_display_height_ / (float)render_height; (float)props->original_display_height_ / (float)render_height;
RemoteAction remote_action; RemoteAction remote_action;
remote_action.m.x = (size_t)(event.button.x * ratio_x); remote_action.m.x =
remote_action.m.y = (size_t)(event.button.y * ratio_y); (size_t)((event.button.x - props->stream_render_rect_.x) * ratio_x);
remote_action.m.y =
(size_t)((event.button.y - props->stream_render_rect_.y) * ratio_y);
if (SDL_MOUSEBUTTONDOWN == event.type) { if (SDL_MOUSEBUTTONDOWN == event.type) {
remote_action.type = ControlType::mouse; remote_action.type = ControlType::mouse;