File tree 4 files changed +22
-10
lines changed
4 files changed +22
-10
lines changed Original file line number Diff line number Diff line change 61
61
<RepositoryUrl >https://github.com/tuyen-vuduc/mapbox-maui</RepositoryUrl >
62
62
<PackageProjectUrl >https://mapbox.tuyen-vuduc.tech</PackageProjectUrl >
63
63
<PackageRequireLicenseAcceptance >false</PackageRequireLicenseAcceptance >
64
- <PackageVersion >11.5.1-alpha08 </PackageVersion >
64
+ <PackageVersion >11.5.1-alpha09 </PackageVersion >
65
65
<PackageReadmeFile >README.md</PackageReadmeFile >
66
66
<PackageLicenseFile >LICENSE</PackageLicenseFile >
67
67
<PackageIcon >tv-mapbox.png</PackageIcon >
Original file line number Diff line number Diff line change 16
16
using Com . Mapbox . Maps . Plugins . Animation ;
17
17
using Com . Mapbox . Functions ;
18
18
using Com . Mapbox . Maps . Plugins ;
19
- using Android . Content . PM ;
20
19
21
20
static class AdditionalExtensions
22
21
{
@@ -60,7 +59,15 @@ internal static double PixelToPoint(this double pixel)
60
59
61
60
return pixel / Metrics . Density ;
62
61
}
63
-
62
+
63
+ internal static double PointToPixel ( this double point )
64
+ {
65
+ Metrics ??= Resources . System ? . DisplayMetrics ;
66
+ if ( Metrics == null ) return 0 ;
67
+
68
+ return point * Metrics . Density ;
69
+ }
70
+
64
71
internal static Java . Lang . Boolean ToPlatform ( this bool xvalue )
65
72
{
66
73
return new Java . Lang . Boolean ( xvalue ) ;
@@ -366,7 +373,9 @@ public static CameraOptions ToX(this CameraState cameraOptions)
366
373
Zoom = ( float ? ) cameraOptions . Zoom ,
367
374
} ;
368
375
public static ScreenPosition ToX ( this ScreenCoordinate screenCoordinate )
369
- => new ( screenCoordinate . GetX ( ) , screenCoordinate . GetY ( ) ) ;
376
+ => new (
377
+ screenCoordinate . GetX ( ) . PixelToPoint ( ) ,
378
+ screenCoordinate . GetY ( ) . PixelToPoint ( ) ) ;
370
379
371
380
public static MapboxMapsCameraOptions ToNative ( this CameraOptions cameraOptions )
372
381
{
Original file line number Diff line number Diff line change @@ -94,10 +94,10 @@ internal static Com.Mapbox.Geojson.Point ToNative(this Point xvalue)
94
94
return Com . Mapbox . Geojson . Point . FromLngLat ( xvalue . Y , xvalue . X ) ;
95
95
}
96
96
97
- internal static Com . Mapbox . Maps . ScreenCoordinate ToScreenCoordinate ( this Point xvalue )
98
- {
99
- return new Com . Mapbox . Maps . ScreenCoordinate ( xvalue . Y , xvalue . X ) ;
100
- }
97
+ internal static Com . Mapbox . Maps . ScreenCoordinate ToScreenCoordinate ( this ScreenPosition xvalue )
98
+ => new Com . Mapbox . Maps . ScreenCoordinate (
99
+ xvalue . X . PointToPixel ( ) ,
100
+ xvalue . Y . PointToPixel ( ) ) ;
101
101
102
102
internal static GeoJSON . Text . Feature . Feature ToX ( this Com . Mapbox . Geojson . Feature src )
103
103
=> new GeoJSON . Text . Feature . Feature (
Original file line number Diff line number Diff line change @@ -14,12 +14,15 @@ public Task<IEnumerable<XQueriedFeature>> QueryRenderedFeaturesWith(ScreenPositi
14
14
Array . Empty < XQueriedFeature > ( ) as IEnumerable < XQueriedFeature >
15
15
) ;
16
16
17
+ var x = point . X . PointToPixel ( ) ;
18
+ var y = point . Y . PointToPixel ( ) ;
19
+
17
20
var tcs = new TaskCompletionSource < IEnumerable < XQueriedFeature > > ( ) ;
18
21
_ = mapView . MapboxMap . QueryRenderedFeatures (
19
22
new RenderedQueryGeometry (
20
23
new ScreenBox (
21
- new ScreenCoordinate ( point . X - 25.0 , point . Y - 25.0 ) ,
22
- new ScreenCoordinate ( point . X + 25.0 , point . Y + 25.0 )
24
+ new ScreenCoordinate ( x - 25.0 , y - 25.0 ) ,
25
+ new ScreenCoordinate ( x + 25.0 , y + 25.0 )
23
26
)
24
27
) ,
25
28
options . ToPlatform ( ) ,
You can’t perform that action at this time.
0 commit comments