Don't create a new flyout every time the graph settings button is clicked (#1197)

* attempt a fix

* fix ranges
This commit is contained in:
Pepe Rivera 2020-04-24 10:02:44 -07:00 committed by GitHub
parent 7fb341e9b2
commit db86e949f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 23 deletions

View File

@ -296,8 +296,7 @@
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
</Storyboard>
<Storyboard/>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
@ -699,8 +698,8 @@
</RepeatButton>
<ToggleButton x:Uid="graphViewButton"
MinHeight="40"
MinWidth="40"
MinHeight="40"
Style="{ThemeResource ThemedGraphViewToggleButtonStyle}"
contract7Present:CornerRadius="{ThemeResource BottomButtonCornerRadius}"
AutomationProperties.AutomationId="graphViewButton"

View File

@ -634,15 +634,18 @@ void GraphingCalculator::DisplayGraphSettings()
m_graphSettings->GraphThemeSettingChanged += ref new EventHandler<bool>(this, &GraphingCalculator::OnGraphThemeSettingChanged);
}
m_graphSettings->IsMatchAppTheme = IsMatchAppTheme;
if (m_graphFlyout == nullptr)
{
m_graphFlyout = ref new Flyout();
m_graphFlyout->Content = m_graphSettings;
}
m_graphSettings->SetGrapher(this->GraphingControl);
auto flyoutGraphSettings = ref new Flyout();
flyoutGraphSettings->Content = m_graphSettings;
flyoutGraphSettings->Closing += ref new TypedEventHandler<FlyoutBase ^, FlyoutBaseClosingEventArgs ^>(this, &GraphingCalculator::OnSettingsFlyout_Closing);
m_graphSettings->IsMatchAppTheme = IsMatchAppTheme;
auto options = ref new FlyoutShowOptions();
options->Placement = FlyoutPlacementMode::BottomEdgeAlignedRight;
flyoutGraphSettings->ShowAt(GraphSettingsButton, options);
m_graphFlyout->ShowAt(GraphSettingsButton, options);
}
void CalculatorApp::GraphingCalculator::AddTracePointerShadow()
@ -660,12 +663,6 @@ void CalculatorApp::GraphingCalculator::AddTracePointerShadow()
::Hosting::ElementCompositionPreview::SetElementChildVisual(CursorShadow, shadowSpriteVisual);
}
void GraphingCalculator::OnSettingsFlyout_Closing(FlyoutBase ^ sender, FlyoutBaseClosingEventArgs ^ args)
{
auto flyout = static_cast<Flyout ^>(sender);
auto graphingSetting = static_cast<GraphingSettings ^>(flyout->Content);
}
void GraphingCalculator::Canvas_SizeChanged(Object ^ /*sender*/, SizeChangedEventArgs ^ e)
{
// Initialize the pointer to the correct location to match initial value in GraphControl\DirectX\RenderMain.cpp
@ -837,5 +834,6 @@ void GraphingCalculator::GraphViewButton_Click(Object ^ sender, RoutedEventArgs
auto announcement = CalculatorAnnouncement::GetGraphViewBestFitChangedAnnouncement(announcementText);
narratorNotifier->Announce(announcement);
TraceLogger::GetInstance()->LogGraphButtonClicked(GraphButton::GraphView, IsManualAdjustment ? GraphButtonValue::ManualAdjustment : GraphButtonValue::AutomaticBestFit);
TraceLogger::GetInstance()->LogGraphButtonClicked(
GraphButton::GraphView, IsManualAdjustment ? GraphButtonValue::ManualAdjustment : GraphButtonValue::AutomaticBestFit);
}

View File

@ -97,8 +97,8 @@ public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INo
Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
bool m_cursorShadowInitialized;
Windows::UI::ViewManagement::UISettings ^ m_uiSettings;
Windows::UI::Xaml::Controls::Flyout ^ m_graphFlyout;
CalculatorApp::GraphingSettings ^ m_graphSettings;
void OnSettingsFlyout_Closing(Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
void Canvas_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);