Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sample): advanced viewport gestures #32

Merged
merged 19 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: [tuyen-vuduc]
buy_me_a_coffee: tuyen.vuduc
custom: ["https://www.paypal.me/tuyenvd"]
2 changes: 0 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var target = Argument("target", "example");
var name = Argument("name", "Awesome");
var index = Argument("index", 0);
var gindex = Argument("gindex", 0);
var group = Argument("group", "None");
var title = Argument("title", "Awesome");
var subtitle = Argument("subtitle", "Awesome");
Expand Down Expand Up @@ -37,7 +36,6 @@ class {name}ExampleInfo : IExampleInfo
public string Title => ""{title ?? "No title"}"";
public string Subtitle => ""{subtitle ?? "No subtitle"}"";
public string PageRoute => typeof({name}Example).FullName;
public int GroupIndex => {gindex};
public int Index => {index};
}}");

Expand Down
59 changes: 53 additions & 6 deletions src/libs/Mapbox.Maui/IMapboxView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using MapboxMaui.Annotations;
using MapboxMaui.Query;
using MapboxMaui.Styles;
using MapboxMaui.Viewport;

public partial interface IMapboxView : IView
{
Expand Down Expand Up @@ -32,6 +33,8 @@ public partial interface IMapboxView : IView
IAnnotationController AnnotationController { get; }

IMapFeatureQueryable QueryManager { get; }

IViewportPlugin Viewport { get; }
}

partial interface IMapboxView
Expand All @@ -47,6 +50,19 @@ partial interface IMapboxView

event EventHandler<MapTappedEventArgs> MapTapped;
ICommand Command { get; }

event EventHandler<CameraChangedEventArgs> CameraChanged;
ICommand CameraChangedCommand { get; }

event EventHandler<Viewport.ViewportStatusChangedEventArgs> ViewportStatusChanged;
ICommand ViewportStatusChangedCommand { get; }

event EventHandler<Gestures.RotatingBeganEventArgs> RotatingBegan;
ICommand RotatingBeganCommand { get; }
event EventHandler<Gestures.RotatingEndedEventArgs> RotatingEnded;
ICommand RotatingEndedCommand { get; }
event EventHandler<Gestures.RotatingEventArgs> Rotating;
ICommand RotatingCommand { get; }
}

public interface IAnnotationController
Expand All @@ -66,12 +82,7 @@ public interface IMapboxController
{
IPosition GetMapPosition(ScreenPosition position);
CoordinateBounds GetCoordinateBoundsForCamera(CameraOptions cameraOptions);
}

public interface IMapCameraController
{
void FlyTo(CameraOptions cameraOptions, AnimationOptions animationOptions = default, Action<AnimationState> completion = default);
void EaseTo(CameraOptions cameraOptions, AnimationOptions animationOptions = default, Action<AnimationState> completion = default);
ScreenPosition GetScreenPosition(IPosition position);
}

public class MapTappedEventArgs : EventArgs
Expand All @@ -82,4 +93,40 @@ public MapTappedEventArgs(MapTappedPosition position)
{
Position = position;
}
}
public class CameraChangedEventArgs : EventArgs
{
public CameraChangedEventArgs(CameraOptions options)
{
Options = options;
}

public CameraOptions Options { get; }
}
public class IndicatorAccuracyRadiusChangedEventArgs : EventArgs
{
public IndicatorAccuracyRadiusChangedEventArgs(double radius)
{
Radius = radius;
}

public double Radius { get; }
}
public class IndicatorBearingChangedEventArgs : EventArgs
{
public IndicatorBearingChangedEventArgs(double bearing)
{
Bearing = bearing;
}

public double Bearing { get; }
}
public class IndicatorPositionChangedEventArgs : EventArgs
{
public IndicatorPositionChangedEventArgs(IPosition position)
{
Position = position;
}

public IPosition Position { get; }
}
44 changes: 13 additions & 31 deletions src/libs/Mapbox.Maui/Mapbox.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@
<RepositoryUrl>https://github.com/tuyen-vuduc/mapbox-maui</RepositoryUrl>
<PackageProjectUrl>https://mapbox.tuyen-vuduc.tech</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageVersion>11.5.0-alpha01</PackageVersion>
<PackageVersion>11.5.1-alpha01</PackageVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>tv-mapbox.png</PackageIcon>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<ItemGroup>
<None Remove="Models\Gestures\" />
</ItemGroup>
<ItemGroup>
<None Include="../../../assets/tv-mapbox.png" Pack="True" PackagePath="tv-mapbox.png" />
<None Include="../../../LICENSE" Pack="True" PackagePath="" />
Expand All @@ -78,32 +81,24 @@
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />
<PackageReference Include="GeoJSON.Text" Version="1.0.2" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PackageReference Include="Com.Mapbox.Maps.Android" Version="11.5.0" />
<PackageReference Include="Com.Mapbox.Maps.Android" Version="11.5.1" />
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.6.1.10" />
<PackageReference Include="Xamarin.AndroidX.Fragment " Version="1.7.0.2" />
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.7.0.2" />
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.9.23.3" PrivateAssets="none" />
<PackageReference Include="Xamarin.Kotlin.StdLib.Common" Version="1.9.23.3" PrivateAssets="none" />
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="2.0.0.1" PrivateAssets="none" />
<PackageReference Include="Xamarin.Kotlin.StdLib.Common" Version="2.0.0.1" PrivateAssets="none" />
<PackageReference Include="Dependencies.Gradle" Version="8.6.0.1" />
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.8.0.1" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.5.1" />
<PackageReference Include="MapboxMaps.iOS" Version="11.5.1" />
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.5.2.2" />
<PackageReference Include="MapboxMaps.iOS" Version="11.5.2" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\Styles\" />
<Folder Include="Models\Styles\Sources\" />
<Folder Include="Models\Expressions\" />
<Folder Include="Models\Styles\Layers\" />
<Folder Include="Models\Annotations\" />
<Folder Include="Platforms\iOS\Annotations\" />
<Folder Include="Platforms\Android\Annotations\" />
<Folder Include="Models\Offline\" />
<Folder Include="Platforms\iOS\Offline\" />
<Folder Include="Platforms\Android\Offline\" />
<Folder Include="Models\Query\" />
<Folder Include="Models\Gestures\" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
Expand All @@ -114,18 +109,5 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<Compile Update="Platforms\Android\MapboxViewHandler.Camera.cs">
<ExcludeFromCurrentConfiguration>true</ExcludeFromCurrentConfiguration>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
</ItemGroup>

<Target
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'"
Name="_GradleDependencyResolverTrigger"
DependsOnTargets="_GradleSync"
BeforeTargets="_BuildLibraryImportsCache" />
<Target Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'" Name="_GradleDependencyResolverTrigger" DependsOnTargets="_GradleSync" BeforeTargets="_BuildLibraryImportsCache" />
</Project>
Loading
Loading