Use Tapped event instead of PointerReleased

This commit is contained in:
Paul Rouget 2019-10-14 09:07:32 +02:00
parent eee2c895f4
commit 010bc0036d
4 changed files with 8 additions and 8 deletions

View file

@ -82,7 +82,7 @@ void App::OnActivated(IActivatedEventArgs const &args) {
} }
auto page = rootFrame.Content().try_as<BrowserPage>(); auto page = rootFrame.Content().try_as<BrowserPage>();
page->LoadServoURI(protocolActivatedEventArgs.Uri()); page->LoadServoURI(protocolActivatedEventArgs.Uri());
// If Servo was opened as a result of clicking on a servo:// URL, // If Servo was opened as a result of clicking on a fxr:// URL,
// we activate transient mode. // we activate transient mode.
page->SetTransientMode(!isRunning); page->SetTransientMode(!isRunning);
} }

View file

@ -36,7 +36,7 @@ void ServoControl::Shutdown() {
void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) { void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) {
auto panel = Panel(); auto panel = Panel();
panel.PointerReleased( panel.Tapped(
std::bind(&ServoControl::OnSurfaceClicked, this, _1, _2)); std::bind(&ServoControl::OnSurfaceClicked, this, _1, _2));
panel.ManipulationStarted( panel.ManipulationStarted(
[=](IInspectable const &, [=](IInspectable const &,
@ -95,10 +95,10 @@ void ServoControl::OnSurfaceManipulationDelta(
} }
void ServoControl::OnSurfaceClicked(IInspectable const &, void ServoControl::OnSurfaceClicked(IInspectable const &,
Input::PointerRoutedEventArgs const &e) { Input::TappedRoutedEventArgs const &e) {
auto coords = e.GetCurrentPoint(Panel()); auto coords = e.GetPosition(Panel());
auto x = coords.Position().X * mDPI; auto x = coords.X * mDPI;
auto y = coords.Position().Y * mDPI; auto y = coords.Y * mDPI;
RunOnGLThread([=] { mServo->Click(x, y); }); RunOnGLThread([=] { mServo->Click(x, y); });
e.Handled(true); e.Handled(true);
} }

View file

@ -118,7 +118,7 @@ private:
void void
OnSurfaceClicked(IInspectable const &, OnSurfaceClicked(IInspectable const &,
Windows::UI::Xaml::Input::PointerRoutedEventArgs const &); Windows::UI::Xaml::Input::TappedRoutedEventArgs const &);
void OnSurfaceManipulationDelta( void OnSurfaceManipulationDelta(
IInspectable const &, IInspectable const &,

View file

@ -9,7 +9,7 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="local:ServoControl"> <ControlTemplate TargetType="local:ServoControl">
<Grid> <Grid>
<SwapChainPanel x:Name="swapChainPanel" MinHeight="200" MinWidth="200" ManipulationMode="All"> <SwapChainPanel x:Name="swapChainPanel" MinHeight="200" MinWidth="200" ManipulationMode="All" IsTapEnabled="True">
</SwapChainPanel> </SwapChainPanel>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>