From eded53abe10ba048651b26d4a3b7a98bc88aab2a Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 10 Aug 2019 18:00:01 -0500 Subject: [PATCH] oh no the DPI scaling doesn't work for this at all --- src/cascadia/TerminalApp/Pane.cpp | 16 +++++++++++++++- src/cascadia/TerminalApp/Pane.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index 473b2f9bd9..f42e8ae440 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -752,7 +752,6 @@ void Pane::_CreateSplitContent() _separatorRoot.Background(brush); - _separatorRoot.ManipulationStarted([this](auto&&, auto& args) { auto pos = args.Position(); pos; @@ -767,6 +766,21 @@ void Pane::_CreateSplitContent() auto offset = transform.TransformPoint({ 0, 0 }); auto delta = args.Delta(); auto deltaTrans = delta.Translation; + + // Turn the delta into a percentage + const Size actualSize{ gsl::narrow_cast(_root.ActualWidth()), + gsl::narrow_cast(_root.ActualHeight()) }; + const bool changeWidth = _splitState == SplitState::Vertical; + auto actualDimension = changeWidth ? actualSize.Width : actualSize.Height; + actualDimension -= PaneSeparatorSize; + + auto deltaPercent = deltaTrans.X / actualDimension; + _firstPercent = _firstPercent.value() + deltaPercent; + _secondPercent = 1.0f - _firstPercent.value(); + + // Resize our columns to match the new percentages. + ResizeContent(actualSize); + // auto trans = transform.try_as(); // auto transform = winrt::Windows::UI::Xaml::TransformToVisual(_root); // auto rel = inverse.TransformPoint(posCopy); diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 91dac73d84..5a9fee7e49 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -97,6 +97,7 @@ private: winrt::Windows::Foundation::Size _GetMinSize() const; winrt::Windows::Foundation::Point cumulative{ 0, 0 }; + float _overDrag = 0; // Function Description: // - Returns true if the given direction can be used with the given split