Skip to content

Commit

Permalink
Improve rotate experience
Browse files Browse the repository at this point in the history
  • Loading branch information
dotMorten committed Aug 5, 2023
1 parent 8cae493 commit b47dfcd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Button Clicked="ToggleViewClick" Text="Toggle MapView/SceneView" />
<Button Clicked="ToggleModelClick" Text="Apply new Map/Scene" />
<Button Clicked="ToggleSymbolsClick" Text="Toggle symbols" />
<Label Text="Map rotation (map only):" />
<Label Text="Map rotation:" />
<Slider Maximum="360" ValueChanged="Slider_ValueChanged" />
<Label Text="Scale factor:" />
<Slider Maximum="50" Minimum="10" Value="{Binding Source={x:Reference SampleOverview}, Path=ScaleFactor, Mode=TwoWay}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;

namespace Toolkit.SampleApp.Maui.Samples
Expand All @@ -20,7 +21,17 @@ public OverviewMapSample()

private void Slider_ValueChanged(object? sender, ValueChangedEventArgs e)
{
MyMapView.SetViewpointRotationAsync(e.NewValue);

if (MyMapView.IsVisible == true)
{
var vp = MyMapView.GetCurrentViewpoint(ViewpointType.CenterAndScale);
MyMapView.SetViewpoint(new Viewpoint(vp.TargetGeometry, e.NewValue));
}
else
{
var camera = MySceneView.Camera;
MySceneView.SetViewpointCamera(camera.RotateTo(e.NewValue, camera.Pitch, camera.Roll));
}
}

private void ToggleViewClick(object? sender, EventArgs e)
Expand Down

0 comments on commit b47dfcd

Please sign in to comment.