Change active tracing to use correct glyph instead of dot (#890)

* Change active tracing to use correct glyph instead of dot

* make the pointer on the glyph line up correctly
This commit is contained in:
Eric Wong
2020-01-03 12:08:02 -08:00
committed by GitHub
parent 3b916dcec3
commit 234ac8deb3
11 changed files with 32 additions and 133 deletions

View File

@@ -424,6 +424,18 @@
</Button>
</StackPanel>
</Border>
<Border x:Name="TracePointer"
Width="16"
Height="18"
Margin="48,50,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Visibility="Collapsed">
<FontIcon Foreground="Red"
FontFamily="{StaticResource CalculatorFontFamily}"
FontSize="18"
Glyph="&#xE3B3;"/>
</Border>
<Border MinWidth="36"
Margin="0,0,12,12"
HorizontalAlignment="Right"

View File

@@ -67,6 +67,9 @@ GraphingCalculator::GraphingCalculator()
// And when the actual trace value changes
GraphingControl->TracingValueChangedEvent += ref new TracingValueChangedEventHandler(this, &GraphingCalculator::OnTracePointChanged);
// Update where the pointer value is (ie: where the user cursor from keyboard inputs moves the point to)
GraphingControl->PointerValueChangedEvent += ref new PointerValueChangedEventHandler(this, &GraphingCalculator::OnPointerPointChanged);
// OemMinus and OemAdd aren't declared in the VirtualKey enum, we can't add this accelerator XAML-side
auto virtualKey = ref new KeyboardAccelerator();
virtualKey->Key = (VirtualKey)187; //OemMinus key
@@ -177,6 +180,13 @@ void GraphingCalculator::OnTracePointChanged(Windows::Foundation::Point newPoint
PositionGraphPopup();
}
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);
}
GraphingCalculatorViewModel ^ GraphingCalculator::ViewModel::get()
{
return m_viewModel;
@@ -479,6 +489,8 @@ void CalculatorApp::GraphingCalculator::ActiveTracing_Checked(Platform::Object ^
this, &CalculatorApp::GraphingCalculator::ActiveTracing_KeyUp);
KeyboardShortcutManager::IgnoreEscape(false);
TracePointer->Visibility = ::Visibility::Visible;
}
void CalculatorApp::GraphingCalculator::ActiveTracing_Unchecked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
@@ -495,6 +507,8 @@ void CalculatorApp::GraphingCalculator::ActiveTracing_Unchecked(Platform::Object
m_activeTracingKeyUpToken.Value = 0;
}
KeyboardShortcutManager::HonorEscape();
TracePointer->Visibility = ::Visibility::Collapsed;
}
void CalculatorApp::GraphingCalculator::ActiveTracing_KeyUp(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ args)

View File

@@ -55,6 +55,7 @@ public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INo
void OnShowTracePopupChanged(bool newValue);
void OnTracePointChanged(Windows::Foundation::Point newPoint);
void OnPointerPointChanged(Windows::Foundation::Point newPoint);
private:
void OnDataRequested(
Windows::ApplicationModel::DataTransfer::DataTransferManager ^ sender,