Added option to enable video panning

This commit is contained in:
Sodra 2022-03-02 18:24:17 -08:00
parent 36f7e102e2
commit b332181937
3 changed files with 26 additions and 10 deletions

View File

@ -611,6 +611,7 @@
"Fast Jump Step" : 10,
"Show Keyframes" : true
},
"Subtitle Sync" : true
"Subtitle Sync" : true,
"Video Pan": false
}
}

View File

@ -433,6 +433,9 @@ void Advanced_Video(wxTreebook *book, Preferences *parent) {
wxArrayString sp_choice = to_wx(SubtitlesProviderFactory::GetClasses());
p->OptionChoice(expert, _("Subtitles provider"), sp_choice, "Subtitle/Provider");
p->OptionChoice(expert, _("Video Panning"), "Video/Video Pan");
#ifdef WITH_AVISYNTH
auto avisynth = p->PageSizer("Avisynth");

View File

@ -372,17 +372,29 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
last_mouse_pos = mouse_pos = event.GetPosition();
if (event.GetButton() == wxMOUSE_BTN_MIDDLE) {
if ((panning = event.ButtonDown()))
pan_last_pos = event.GetPosition();
}
if (panning && event.Dragging()) {
pan_x += event.GetX() - pan_last_pos.X();
pan_y += event.GetY() - pan_last_pos.Y();
pan_last_pos = event.GetPosition();
///if video pan
bool videoPan = OPT_GET("Video/Video Pan")->GetBool();
PositionVideo();
if (videoPan){
if (event.GetButton() == wxMOUSE_BTN_MIDDLE) {
if ((panning = event.ButtonDown()))
pan_last_pos = event.GetPosition();
}
if (panning && event.Dragging()) {
pan_x += event.GetX() - pan_last_pos.X();
pan_y += event.GetY() - pan_last_pos.Y();
pan_last_pos = event.GetPosition();
PositionVideo();
}
}
else if ((pan_x != 0 || pan_y != 0) && !videoPan)
{
pan_x = pan_y = 0;
PositionVideo();
}
///
if (tool)
tool->OnMouseEvent(event);