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:
parent
7fb341e9b2
commit
db86e949f9
@ -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"
|
||||
|
@ -95,7 +95,7 @@ GraphingCalculator::GraphingCalculator()
|
||||
{
|
||||
SharedShadow->Receivers->Append(GraphingControl);
|
||||
}
|
||||
|
||||
|
||||
m_accessibilitySettings->HighContrastChanged +=
|
||||
ref new TypedEventHandler<AccessibilitySettings ^, Object ^>(this, &GraphingCalculator::OnHighContrastChanged);
|
||||
|
||||
@ -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
|
||||
@ -812,12 +809,12 @@ void GraphingCalculator::OnGraphThemeSettingChanged(Object ^ sender, bool isMatc
|
||||
IsMatchAppTheme = isMatchAppTheme;
|
||||
WeakReference weakThis(this);
|
||||
this->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([weakThis]() {
|
||||
auto refThis = weakThis.Resolve<GraphingCalculator>();
|
||||
if (refThis != nullptr)
|
||||
{
|
||||
refThis->UpdateGraphTheme();
|
||||
}
|
||||
}));
|
||||
auto refThis = weakThis.Resolve<GraphingCalculator>();
|
||||
if (refThis != nullptr)
|
||||
{
|
||||
refThis->UpdateGraphTheme();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void GraphingCalculator::GraphViewButton_Click(Object ^ sender, RoutedEventArgs ^ e)
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user