diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml
index 8a885fdf..7ea25cdb 100644
--- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml
+++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml
@@ -312,6 +312,11 @@
+
+
@@ -358,6 +368,11 @@
+
@@ -413,6 +428,7 @@
@@ -507,18 +523,17 @@
-
-
-
+
Key = (VirtualKey)187; // OemAdd key
virtualKey->Modifiers = VirtualKeyModifiers::Control;
ZoomInButton->KeyboardAccelerators->Append(virtualKey);
+
+ // add shadow to the trace pointer
+ AddTracePointerShadow();
+ // hide the shadow in high contrast mode
+ CursorShadow->Visibility = m_accessibilitySettings->HighContrast ? ::Visibility::Collapsed : ::Visibility::Visible;
+ m_accessibilitySettings->HighContrastChanged +=
+ ref new TypedEventHandler(this, &GraphingCalculator::OnHighContrastChanged);
}
void GraphingCalculator::OnShowTracePopupChanged(bool newValue)
@@ -185,8 +194,8 @@ void GraphingCalculator::OnTracePointChanged(Point newPoint)
void CalculatorApp::GraphingCalculator::OnPointerPointChanged(Windows::Foundation::Point newPoint)
{
// Move the pointer glyph to where it is supposed to be.
- // because the glyph is centered and has some spacing, to get the point to properly line up with the glyph, move the x point over 2 px
- TracePointer->Margin = Thickness(newPoint.X - 2, newPoint.Y, 0, 0);
+ Canvas::SetLeft(TracePointer, newPoint.X);
+ Canvas::SetTop(TracePointer, newPoint.Y);
}
GraphingCalculatorViewModel ^ GraphingCalculator::ViewModel::get()
@@ -537,6 +546,21 @@ void GraphingCalculator::DisplayGraphSettings()
flyoutGraphSettings->ShowAt(GraphSettingsButton);
}
+void CalculatorApp::GraphingCalculator::AddTracePointerShadow()
+{
+ auto compositor = ::Hosting::ElementCompositionPreview::GetElementVisual(CursorPath)->Compositor;
+ auto dropShadow = compositor->CreateDropShadow();
+ dropShadow->BlurRadius = 6;
+ dropShadow->Opacity = 0.33f;
+ dropShadow->Offset = ::Numerics::float3(2, 2, 0);
+ dropShadow->Mask = CursorPath->GetAlphaMask();
+
+ auto shadowSpriteVisual = compositor->CreateSpriteVisual();
+ shadowSpriteVisual->Size = ::Numerics::float2(static_cast(CursorPath->ActualWidth), static_cast(CursorPath->ActualHeight));
+ shadowSpriteVisual->Shadow = dropShadow;
+ ::Hosting::ElementCompositionPreview::SetElementChildVisual(CursorShadow, shadowSpriteVisual);
+}
+
void GraphingCalculator::OnSettingsFlyout_Closing(FlyoutBase ^ sender, FlyoutBaseClosingEventArgs ^ args)
{
auto flyout = static_cast(sender);
@@ -544,6 +568,18 @@ void GraphingCalculator::OnSettingsFlyout_Closing(FlyoutBase ^ sender, FlyoutBas
args->Cancel = graphingSetting->CanBeClose();
}
+void GraphingCalculator::LeftGrid_SizeChanged(Object ^ /*sender*/, SizeChangedEventArgs ^ e)
+{
+ // Initialize the pointer to the correct location to match initial value in GraphControl\DirectX\RenderMain.cpp
+ Canvas::SetLeft(TracePointer, e->NewSize.Width / 2 + 40);
+ Canvas::SetTop(TracePointer, e->NewSize.Height / 2 - 40);
+}
+
+void GraphingCalculator::OnHighContrastChanged(AccessibilitySettings ^ sender, Object ^ /*args*/)
+{
+ CursorShadow->Visibility = sender->HighContrast ? ::Visibility::Collapsed : ::Visibility::Visible;
+}
+
void GraphingCalculator::OnEquationFormatRequested(Object ^ sender, MathRichEditBoxFormatRequest ^ e)
{
if (!e->OriginalText->IsEmpty())
diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h
index c1b41342..dfc882bd 100644
--- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h
+++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h
@@ -74,6 +74,7 @@ public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INo
void GraphSettingsButton_Click(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void SwitchModeToggleButton_Toggled(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void DisplayGraphSettings();
+ void AddTracePointerShadow();
private:
Windows::Foundation::EventRegistrationToken m_dataRequestedToken;
@@ -82,8 +83,11 @@ public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INo
Windows::Foundation::EventRegistrationToken m_activeTracingKeyUpToken;
Windows::Foundation::EventRegistrationToken m_ActiveTracingPointerCaptureLost;
CalculatorApp::ViewModel::GraphingCalculatorViewModel ^ m_viewModel;
+ Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
void
OnSettingsFlyout_Closing(Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
+ void LeftGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
+ void OnHighContrastChanged(Windows::UI::ViewManagement::AccessibilitySettings ^ sender, Platform::Object ^ args);
void OnEquationFormatRequested(Platform::Object ^ sender, CalculatorApp::Controls::MathRichEditBoxFormatRequest ^ e);
};
diff --git a/src/Calculator/pch.h b/src/Calculator/pch.h
index d53bce71..4bf2fe60 100644
--- a/src/Calculator/pch.h
+++ b/src/Calculator/pch.h
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
// C++\WinRT Headers
#include "winrt/base.h"
diff --git a/src/GraphControl/Control/Grapher.cpp b/src/GraphControl/Control/Grapher.cpp
index 16ec5d8a..af19d68e 100644
--- a/src/GraphControl/Control/Grapher.cpp
+++ b/src/GraphControl/Control/Grapher.cpp
@@ -287,7 +287,7 @@ namespace GraphControl
if (graphExpression = m_solver->ParseInput(request))
{
initResult = TryInitializeGraph(keepCurrentView, graphExpression.get());
-
+
if (initResult != nullopt)
{
UpdateGraphOptions(m_graph->GetOptions(), validEqs);
diff --git a/src/GraphControl/DirectX/RenderMain.cpp b/src/GraphControl/DirectX/RenderMain.cpp
index c70970b8..b06effb3 100644
--- a/src/GraphControl/DirectX/RenderMain.cpp
+++ b/src/GraphControl/DirectX/RenderMain.cpp
@@ -44,8 +44,6 @@ namespace GraphControl::DX
RegisterEventHandlers();
m_drawActiveTracing = false;
- m_activeTracingPointerLocation.X = 50;
- m_activeTracingPointerLocation.Y = 50;
}
RenderMain::~RenderMain()
@@ -65,6 +63,7 @@ namespace GraphControl::DX
renderer->SetDpi(dpi, dpi);
renderer->SetGraphSize(static_cast(m_swapChainPanel->ActualWidth), static_cast(m_swapChainPanel->ActualHeight));
+
}
}
}
@@ -120,6 +119,13 @@ namespace GraphControl::DX
{
// TODO: Replace this with the sizedependent initialization of your app's content.
RunRenderPass();
+
+ if (m_swapChainPanel != nullptr)
+ {
+ // Initialize the active tracing location to just above and to the right of the center of the graph area
+ m_activeTracingPointerLocation.X = m_swapChainPanel->ActualWidth / 2 + 40;
+ m_activeTracingPointerLocation.Y = m_swapChainPanel->ActualHeight / 2 - 40;
+ }
}
bool RenderMain::RunRenderPass()