From e1d56f9294f5af9d7f602077c19ef463fa5e0669 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 29 Jun 2014 11:39:51 -0700 Subject: [PATCH] Update all selected lines when dragging the origin in the rotate tools --- src/visual_tool_rotatexy.cpp | 13 ++++++++++++- src/visual_tool_rotatez.cpp | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/visual_tool_rotatexy.cpp b/src/visual_tool_rotatexy.cpp index 40020b197..0a6949c22 100644 --- a/src/visual_tool_rotatexy.cpp +++ b/src/visual_tool_rotatexy.cpp @@ -20,6 +20,9 @@ #include "visual_tool_rotatexy.h" +#include "include/aegisub/context.h" +#include "selection_controller.h" + #include #include @@ -168,7 +171,15 @@ void VisualToolRotateXY::UpdateHold() { } void VisualToolRotateXY::UpdateDrag(Feature *feature) { - SetOverride(active_line, "\\org", ToScriptCoords(feature->pos).PStr()); + auto org = GetLineOrigin(active_line); + if (!org) org = GetLinePosition(active_line); + auto d = ToScriptCoords(feature->pos) - org; + + for (auto line : c->selectionController->GetSelectedSet()) { + org = GetLineOrigin(line); + if (!org) org = GetLinePosition(line); + SetOverride(line, "\\org", (d + org).PStr()); + } } void VisualToolRotateXY::DoRefresh() { diff --git a/src/visual_tool_rotatez.cpp b/src/visual_tool_rotatez.cpp index eac48c8f9..9e7e1f8e6 100644 --- a/src/visual_tool_rotatez.cpp +++ b/src/visual_tool_rotatez.cpp @@ -20,6 +20,9 @@ #include "visual_tool_rotatez.h" +#include "include/aegisub/context.h" +#include "selection_controller.h" + #include #include @@ -113,7 +116,15 @@ void VisualToolRotateZ::UpdateHold() { } void VisualToolRotateZ::UpdateDrag(Feature *feature) { - SetOverride(active_line, "\\org", ToScriptCoords(feature->pos).PStr()); + auto org = GetLineOrigin(active_line); + if (!org) org = GetLinePosition(active_line); + auto d = ToScriptCoords(feature->pos) - org; + + for (auto line : c->selectionController->GetSelectedSet()) { + org = GetLineOrigin(line); + if (!org) org = GetLinePosition(line); + SetOverride(line, "\\org", (d + org).PStr()); + } } void VisualToolRotateZ::DoRefresh() {