diff --git a/src/command/video.cpp b/src/command/video.cpp index d3ffaf7fe..40ffb977b 100644 --- a/src/command/video.cpp +++ b/src/command/video.cpp @@ -603,6 +603,17 @@ struct video_opt_autoscroll final : public Command { } }; +struct video_pan_reset final : public validator_video_loaded { + CMD_NAME("video/pan_reset") + STR_MENU("Reset video pan") + STR_DISP("Reset video pan") + STR_HELP("Reset the video pan to the original value") + + void operator()(agi::Context *c) override { + c->videoDisplay->ResetPan(); + } +}; + struct video_play final : public validator_video_loaded { CMD_NAME("video/play") CMD_ICON(button_play) @@ -767,6 +778,7 @@ namespace cmd { reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); + reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); diff --git a/src/libresrc/default_menu.json b/src/libresrc/default_menu.json index b1797836f..81214dc08 100644 --- a/src/libresrc/default_menu.json +++ b/src/libresrc/default_menu.json @@ -156,6 +156,7 @@ { "submenu" : "main/video/set zoom", "text" : "Set &Zoom" }, { "submenu" : "main/video/override ar", "text" : "Override &AR" }, { "command" : "video/show_overscan" }, + { "command" : "video/pan_reset" }, {}, { "command" : "video/jump" }, { "command" : "video/jump/start" }, diff --git a/src/video_display.cpp b/src/video_display.cpp index 73df313ba..5107e2b29 100644 --- a/src/video_display.cpp +++ b/src/video_display.cpp @@ -398,6 +398,11 @@ void VideoDisplay::OnKeyDown(wxKeyEvent &event) { hotkey::check("Video", con, event); } +void VideoDisplay::ResetPan() { + pan_x = pan_y = 0; + PositionVideo(); +} + void VideoDisplay::SetZoom(double value) { if (value == 0) return; zoomValue = std::max(value, .125); diff --git a/src/video_display.h b/src/video_display.h index 46ed78a69..680873518 100644 --- a/src/video_display.h +++ b/src/video_display.h @@ -169,6 +169,9 @@ public: /// @brief Get the current zoom level double GetZoom() const { return zoomValue; } + /// @brief Reset the video pan + void ResetPan(); + /// Get the last seen position of the mouse in script coordinates Vector2D GetMousePosition() const;