@lugg/maps 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/android/src/main/java/com/luggmaps/LuggCircleView.kt +85 -0
- package/android/src/main/java/com/luggmaps/LuggCircleViewManager.kt +79 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayView.kt +81 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayViewManager.kt +82 -0
- package/android/src/main/java/com/luggmaps/LuggMapView.kt +9 -0
- package/android/src/main/java/com/luggmaps/LuggPackage.kt +4 -1
- package/android/src/main/java/com/luggmaps/LuggTileOverlayView.kt +92 -0
- package/android/src/main/java/com/luggmaps/LuggTileOverlayViewManager.kt +80 -0
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +289 -0
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +9 -0
- package/android/src/main/java/com/luggmaps/events/CirclePressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/GroundOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/TileOverlayPressEvent.kt +12 -0
- package/ios/LuggCircleView.h +31 -0
- package/ios/LuggCircleView.mm +133 -0
- package/ios/LuggGroundOverlayView.h +30 -0
- package/ios/LuggGroundOverlayView.mm +125 -0
- package/ios/LuggMapView.mm +43 -0
- package/ios/LuggTileOverlayView.h +31 -0
- package/ios/LuggTileOverlayView.mm +130 -0
- package/ios/core/AppleMapProvider.mm +398 -1
- package/ios/core/GoogleMapProvider.mm +299 -10
- package/ios/core/MapProviderDelegate.h +12 -0
- package/ios/events/CirclePressEvent.h +20 -0
- package/ios/events/GroundOverlayPressEvent.h +20 -0
- package/ios/events/TileOverlayPressEvent.h +20 -0
- package/lib/module/components/Circle.js +46 -0
- package/lib/module/components/Circle.js.map +1 -0
- package/lib/module/components/Circle.types.js +4 -0
- package/lib/module/components/Circle.types.js.map +1 -0
- package/lib/module/components/Circle.web.js +79 -0
- package/lib/module/components/Circle.web.js.map +1 -0
- package/lib/module/components/GroundOverlay.js +45 -0
- package/lib/module/components/GroundOverlay.js.map +1 -0
- package/lib/module/components/GroundOverlay.types.js +4 -0
- package/lib/module/components/GroundOverlay.types.js.map +1 -0
- package/lib/module/components/GroundOverlay.web.js +77 -0
- package/lib/module/components/GroundOverlay.web.js.map +1 -0
- package/lib/module/components/Marker.js +5 -1
- package/lib/module/components/Marker.js.map +1 -1
- package/lib/module/components/TileOverlay.js +44 -0
- package/lib/module/components/TileOverlay.js.map +1 -0
- package/lib/module/components/TileOverlay.types.js +4 -0
- package/lib/module/components/TileOverlay.types.js.map +1 -0
- package/lib/module/components/TileOverlay.web.js +69 -0
- package/lib/module/components/TileOverlay.web.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/index.web.js +3 -0
- package/lib/module/components/index.web.js.map +1 -1
- package/lib/module/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/lib/module/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/lib/module/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +3 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/src/components/Circle.d.ts +10 -0
- package/lib/typescript/src/components/Circle.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.types.d.ts +33 -0
- package/lib/typescript/src/components/Circle.types.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.web.d.ts +3 -0
- package/lib/typescript/src/components/Circle.web.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.d.ts +10 -0
- package/lib/typescript/src/components/GroundOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts +35 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/Marker.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.types.d.ts +4 -1
- package/lib/typescript/src/components/Marker.types.d.ts.map +1 -1
- package/lib/typescript/src/components/TileOverlay.d.ts +10 -0
- package/lib/typescript/src/components/TileOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts +36 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +6 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/index.web.d.ts +6 -0
- package/lib/typescript/src/components/index.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts +18 -0
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +6 -0
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/components/Circle.tsx +52 -0
- package/src/components/Circle.types.ts +33 -0
- package/src/components/Circle.web.tsx +93 -0
- package/src/components/GroundOverlay.tsx +47 -0
- package/src/components/GroundOverlay.types.ts +36 -0
- package/src/components/GroundOverlay.web.tsx +85 -0
- package/src/components/Marker.tsx +4 -1
- package/src/components/Marker.types.ts +4 -1
- package/src/components/TileOverlay.tsx +44 -0
- package/src/components/TileOverlay.types.ts +37 -0
- package/src/components/TileOverlay.web.tsx +95 -0
- package/src/components/index.ts +9 -0
- package/src/components/index.web.ts +9 -0
- package/src/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/src/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/src/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/src/index.ts +6 -0
- package/src/index.web.ts +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TileOverlay.web.d.ts","sourceRoot":"","sources":["../../../../src/components/TileOverlay.web.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,GAAI,8DAOzB,gBAAgB,SAmFlB,CAAC"}
|
|
@@ -2,8 +2,14 @@ export { Marker } from './Marker';
|
|
|
2
2
|
export type { CalloutOptions, MarkerProps, MarkerPressEvent, MarkerDragEvent, } from './Marker.types';
|
|
3
3
|
export { Polygon } from './Polygon';
|
|
4
4
|
export type { PolygonProps } from './Polygon.types';
|
|
5
|
+
export { Circle } from './Circle';
|
|
6
|
+
export type { CircleProps } from './Circle.types';
|
|
5
7
|
export { Polyline } from './Polyline';
|
|
6
8
|
export type { PolylineProps, PolylineEasing, PolylineAnimatedOptions, } from './Polyline.types';
|
|
7
9
|
export { GeoJson } from './GeoJson';
|
|
8
10
|
export type { GeoJsonProps } from './GeoJson.types';
|
|
11
|
+
export { GroundOverlay } from './GroundOverlay';
|
|
12
|
+
export type { GroundOverlayProps, GroundOverlayBounds, } from './GroundOverlay.types';
|
|
13
|
+
export { TileOverlay } from './TileOverlay';
|
|
14
|
+
export type { TileOverlayProps, TileOverlayBounds } from './TileOverlay.types';
|
|
9
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,aAAa,EACb,cAAc,EACd,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,aAAa,EACb,cAAc,EACd,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export { Marker } from './Marker.web';
|
|
2
2
|
export { Polygon } from './Polygon.web';
|
|
3
|
+
export { Circle } from './Circle.web';
|
|
3
4
|
export { Polyline } from './Polyline.web';
|
|
4
5
|
export type { CalloutOptions, MarkerProps } from './Marker.types';
|
|
5
6
|
export type { PolygonProps } from './Polygon.types';
|
|
7
|
+
export type { CircleProps } from './Circle.types';
|
|
6
8
|
export type { PolylineProps } from './Polyline.types';
|
|
7
9
|
export { GeoJson } from './GeoJson';
|
|
8
10
|
export type { GeoJsonProps } from './GeoJson.types';
|
|
11
|
+
export { GroundOverlay } from './GroundOverlay.web';
|
|
12
|
+
export type { GroundOverlayProps, GroundOverlayBounds, } from './GroundOverlay.types';
|
|
13
|
+
export { TileOverlay } from './TileOverlay.web';
|
|
14
|
+
export type { TileOverlayProps, TileOverlayBounds } from './TileOverlay.types';
|
|
9
15
|
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/components/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/components/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ViewProps, HostComponent, ColorValue } from 'react-native';
|
|
2
|
+
import type { Double, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export interface Coordinate {
|
|
4
|
+
latitude: Double;
|
|
5
|
+
longitude: Double;
|
|
6
|
+
}
|
|
7
|
+
export interface NativeProps extends ViewProps {
|
|
8
|
+
center: Coordinate;
|
|
9
|
+
radius?: Double;
|
|
10
|
+
strokeColor?: ColorValue;
|
|
11
|
+
strokeWidth?: Double;
|
|
12
|
+
fillColor?: ColorValue;
|
|
13
|
+
tappable?: boolean;
|
|
14
|
+
onCirclePress?: DirectEventHandler<null>;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: HostComponent<NativeProps>;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=LuggCircleViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LuggCircleViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/fabric/LuggCircleViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;CAC1C;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ViewProps, HostComponent } from 'react-native';
|
|
2
|
+
import type { Double, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export interface Coordinate {
|
|
4
|
+
latitude: Double;
|
|
5
|
+
longitude: Double;
|
|
6
|
+
}
|
|
7
|
+
export interface Bounds {
|
|
8
|
+
northeast: Coordinate;
|
|
9
|
+
southwest: Coordinate;
|
|
10
|
+
}
|
|
11
|
+
export interface NativeProps extends ViewProps {
|
|
12
|
+
image: string;
|
|
13
|
+
bounds: Bounds;
|
|
14
|
+
opacity?: Double;
|
|
15
|
+
bearing?: Double;
|
|
16
|
+
tappable?: boolean;
|
|
17
|
+
onGroundOverlayPress?: DirectEventHandler<null>;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: HostComponent<NativeProps>;
|
|
20
|
+
export default _default;
|
|
21
|
+
//# sourceMappingURL=LuggGroundOverlayViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LuggGroundOverlayViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/fabric/LuggGroundOverlayViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;CACjD;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ViewProps, HostComponent } from 'react-native';
|
|
2
|
+
import type { Double, Int32, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export interface Coordinate {
|
|
4
|
+
latitude: Double;
|
|
5
|
+
longitude: Double;
|
|
6
|
+
}
|
|
7
|
+
export interface Bounds {
|
|
8
|
+
northeast: Coordinate;
|
|
9
|
+
southwest: Coordinate;
|
|
10
|
+
}
|
|
11
|
+
export interface NativeProps extends ViewProps {
|
|
12
|
+
urlTemplate: string;
|
|
13
|
+
tileSize?: Int32;
|
|
14
|
+
opacity?: Double;
|
|
15
|
+
bounds?: Bounds;
|
|
16
|
+
tappable?: boolean;
|
|
17
|
+
onTileOverlayPress?: DirectEventHandler<null>;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: HostComponent<NativeProps>;
|
|
20
|
+
export default _default;
|
|
21
|
+
//# sourceMappingURL=LuggTileOverlayViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LuggTileOverlayViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/fabric/LuggTileOverlayViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;CAC/C;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
|
|
@@ -5,10 +5,16 @@ export { Marker } from './components';
|
|
|
5
5
|
export type { CalloutOptions, MarkerProps, MarkerPressEvent, MarkerDragEvent, } from './components';
|
|
6
6
|
export { Polygon } from './components';
|
|
7
7
|
export type { PolygonProps } from './components';
|
|
8
|
+
export { Circle } from './components';
|
|
9
|
+
export type { CircleProps } from './components';
|
|
8
10
|
export { Polyline } from './components';
|
|
9
11
|
export type { PolylineProps, PolylineEasing, PolylineAnimatedOptions, } from './components';
|
|
10
12
|
export { GeoJson } from './components';
|
|
11
13
|
export type { GeoJsonProps } from './components';
|
|
14
|
+
export { GroundOverlay } from './components';
|
|
15
|
+
export type { GroundOverlayProps, GroundOverlayBounds } from './components';
|
|
16
|
+
export { TileOverlay } from './components';
|
|
17
|
+
export type { TileOverlayProps, TileOverlayBounds } from './components';
|
|
12
18
|
export type { MapViewProps, MapViewRef, MoveCameraOptions, FitCoordinatesOptions, SetEdgeInsetsOptions, CameraEventPayload, MapCameraEvent, MapPressEvent, } from './MapView.types';
|
|
13
19
|
export type { MapProvider as MapProviderType, MapTheme, Coordinate, Point, EdgeInsets, PressEventPayload, } from './types';
|
|
14
20
|
export type { GeoJSON, Feature, FeatureCollection, FeatureProperties, Geometry, Position, } from './components/GeoJson.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,YAAY,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,YAAY,EACV,aAAa,EACb,cAAc,EACd,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,QAAQ,EACR,UAAU,EACV,KAAK,EACL,UAAU,EACV,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,GACT,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,YAAY,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,YAAY,EACV,aAAa,EACb,cAAc,EACd,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,YAAY,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,QAAQ,EACR,UAAU,EACV,KAAK,EACL,UAAU,EACV,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,GACT,MAAM,4BAA4B,CAAC"}
|
|
@@ -5,10 +5,16 @@ export { Marker } from './components/index.web';
|
|
|
5
5
|
export type { CalloutOptions, MarkerProps } from './components/index.web';
|
|
6
6
|
export { Polygon } from './components/index.web';
|
|
7
7
|
export type { PolygonProps } from './components/index.web';
|
|
8
|
+
export { Circle } from './components/index.web';
|
|
9
|
+
export type { CircleProps } from './components/index.web';
|
|
8
10
|
export { Polyline } from './components/index.web';
|
|
9
11
|
export type { PolylineProps } from './components/index.web';
|
|
10
12
|
export { GeoJson } from './components/index.web';
|
|
11
13
|
export type { GeoJsonProps } from './components/index.web';
|
|
14
|
+
export { GroundOverlay } from './components/index.web';
|
|
15
|
+
export type { GroundOverlayProps, GroundOverlayBounds, } from './components/index.web';
|
|
16
|
+
export { TileOverlay } from './components/index.web';
|
|
17
|
+
export type { TileOverlayProps, TileOverlayBounds, } from './components/index.web';
|
|
12
18
|
export type { MapViewProps, MapViewRef, MoveCameraOptions, FitCoordinatesOptions, CameraEventPayload, } from './MapView.types';
|
|
13
19
|
export type { MapProvider as MapProviderType, Coordinate, Point, EdgeInsets, } from './types';
|
|
14
20
|
export type { GeoJSON, Feature, FeatureCollection, FeatureProperties, Geometry, Position, } from './components/GeoJson.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,UAAU,EACV,KAAK,EACL,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,GACT,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,UAAU,EACV,KAAK,EACL,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,GACT,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lugg/maps",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "Universal maps for React Native.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -150,7 +150,10 @@
|
|
|
150
150
|
"LuggCalloutView": "LuggCalloutView",
|
|
151
151
|
"LuggMapWrapperView": "LuggMapWrapperView",
|
|
152
152
|
"LuggPolylineView": "LuggPolylineView",
|
|
153
|
-
"LuggPolygonView": "LuggPolygonView"
|
|
153
|
+
"LuggPolygonView": "LuggPolygonView",
|
|
154
|
+
"LuggCircleView": "LuggCircleView",
|
|
155
|
+
"LuggGroundOverlayView": "LuggGroundOverlayView",
|
|
156
|
+
"LuggTileOverlayView": "LuggTileOverlayView"
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
},
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import LuggCircleViewNativeComponent from '../fabric/LuggCircleViewNativeComponent';
|
|
4
|
+
import type { CircleProps } from './Circle.types';
|
|
5
|
+
|
|
6
|
+
export type { CircleProps } from './Circle.types';
|
|
7
|
+
|
|
8
|
+
export class Circle extends React.PureComponent<CircleProps> {
|
|
9
|
+
private _cachedZIndex: number | undefined;
|
|
10
|
+
private _cachedStyle: any;
|
|
11
|
+
|
|
12
|
+
private getStyle(zIndex: number | undefined) {
|
|
13
|
+
if (zIndex == null) return styles.circle;
|
|
14
|
+
if (zIndex !== this._cachedZIndex) {
|
|
15
|
+
this._cachedZIndex = zIndex;
|
|
16
|
+
this._cachedStyle = [{ zIndex }, styles.circle];
|
|
17
|
+
}
|
|
18
|
+
return this._cachedStyle!;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
render() {
|
|
22
|
+
const {
|
|
23
|
+
center,
|
|
24
|
+
radius,
|
|
25
|
+
strokeColor,
|
|
26
|
+
strokeWidth,
|
|
27
|
+
fillColor,
|
|
28
|
+
zIndex,
|
|
29
|
+
onPress,
|
|
30
|
+
} = this.props;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<LuggCircleViewNativeComponent
|
|
34
|
+
style={this.getStyle(zIndex)}
|
|
35
|
+
center={center}
|
|
36
|
+
radius={radius}
|
|
37
|
+
strokeColor={strokeColor}
|
|
38
|
+
strokeWidth={strokeWidth}
|
|
39
|
+
fillColor={fillColor}
|
|
40
|
+
tappable={!!onPress}
|
|
41
|
+
onCirclePress={onPress}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
circle: {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
pointerEvents: 'none',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import type { Coordinate } from '../types';
|
|
3
|
+
|
|
4
|
+
export interface CircleProps {
|
|
5
|
+
/**
|
|
6
|
+
* Center coordinate of the circle
|
|
7
|
+
*/
|
|
8
|
+
center: Coordinate;
|
|
9
|
+
/**
|
|
10
|
+
* Radius in meters
|
|
11
|
+
*/
|
|
12
|
+
radius: number;
|
|
13
|
+
/**
|
|
14
|
+
* Stroke (outline) color
|
|
15
|
+
*/
|
|
16
|
+
strokeColor?: ColorValue;
|
|
17
|
+
/**
|
|
18
|
+
* Stroke width in points
|
|
19
|
+
*/
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Fill color of the circle
|
|
23
|
+
*/
|
|
24
|
+
fillColor?: ColorValue;
|
|
25
|
+
/**
|
|
26
|
+
* Z-index for layering
|
|
27
|
+
*/
|
|
28
|
+
zIndex?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Called when the circle is tapped
|
|
31
|
+
*/
|
|
32
|
+
onPress?: () => void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { useMapContext } from '../MapProvider.web';
|
|
3
|
+
import type { CircleProps } from './Circle.types';
|
|
4
|
+
|
|
5
|
+
export const Circle = ({
|
|
6
|
+
center,
|
|
7
|
+
radius,
|
|
8
|
+
strokeColor = '#000000',
|
|
9
|
+
strokeWidth = 1,
|
|
10
|
+
fillColor = 'rgba(0, 0, 0, 0.3)',
|
|
11
|
+
zIndex = 0,
|
|
12
|
+
onPress,
|
|
13
|
+
}: CircleProps) => {
|
|
14
|
+
const { map } = useMapContext();
|
|
15
|
+
const circleRef = useRef<google.maps.Circle | null>(null);
|
|
16
|
+
const listenersRef = useRef<google.maps.MapsEventListener[]>([]);
|
|
17
|
+
|
|
18
|
+
const handleClick = useCallback(() => {
|
|
19
|
+
onPress?.();
|
|
20
|
+
}, [onPress]);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
return () => {
|
|
24
|
+
listenersRef.current.forEach((l) => l.remove());
|
|
25
|
+
listenersRef.current = [];
|
|
26
|
+
circleRef.current?.setMap(null);
|
|
27
|
+
circleRef.current = null;
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const circle = circleRef.current;
|
|
33
|
+
if (!circle) return;
|
|
34
|
+
|
|
35
|
+
listenersRef.current.forEach((l) => l.remove());
|
|
36
|
+
listenersRef.current = [];
|
|
37
|
+
|
|
38
|
+
if (onPress) {
|
|
39
|
+
listenersRef.current.push(circle.addListener('click', handleClick));
|
|
40
|
+
}
|
|
41
|
+
circle.set('clickable', !!onPress);
|
|
42
|
+
}, [onPress, handleClick]);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!map) {
|
|
46
|
+
circleRef.current?.setMap(null);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const googleCenter = { lat: center.latitude, lng: center.longitude };
|
|
51
|
+
|
|
52
|
+
if (circleRef.current) {
|
|
53
|
+
circleRef.current.setCenter(googleCenter);
|
|
54
|
+
circleRef.current.setRadius(radius);
|
|
55
|
+
circleRef.current.setOptions({
|
|
56
|
+
strokeColor: strokeColor as string,
|
|
57
|
+
strokeWeight: strokeWidth,
|
|
58
|
+
fillColor: fillColor as string,
|
|
59
|
+
zIndex,
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
const circle = new google.maps.Circle({
|
|
63
|
+
center: googleCenter,
|
|
64
|
+
radius,
|
|
65
|
+
strokeColor: strokeColor as string,
|
|
66
|
+
strokeWeight: strokeWidth,
|
|
67
|
+
strokeOpacity: 1,
|
|
68
|
+
fillColor: fillColor as string,
|
|
69
|
+
fillOpacity: 1,
|
|
70
|
+
zIndex,
|
|
71
|
+
clickable: !!onPress,
|
|
72
|
+
map,
|
|
73
|
+
});
|
|
74
|
+
circleRef.current = circle;
|
|
75
|
+
|
|
76
|
+
if (onPress) {
|
|
77
|
+
listenersRef.current.push(circle.addListener('click', handleClick));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, [
|
|
81
|
+
map,
|
|
82
|
+
center,
|
|
83
|
+
radius,
|
|
84
|
+
strokeColor,
|
|
85
|
+
strokeWidth,
|
|
86
|
+
fillColor,
|
|
87
|
+
zIndex,
|
|
88
|
+
onPress,
|
|
89
|
+
handleClick,
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
return null;
|
|
93
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, StyleSheet } from 'react-native';
|
|
3
|
+
import LuggGroundOverlayViewNativeComponent from '../fabric/LuggGroundOverlayViewNativeComponent';
|
|
4
|
+
import type { GroundOverlayProps } from './GroundOverlay.types';
|
|
5
|
+
|
|
6
|
+
export type {
|
|
7
|
+
GroundOverlayProps,
|
|
8
|
+
GroundOverlayBounds,
|
|
9
|
+
} from './GroundOverlay.types';
|
|
10
|
+
|
|
11
|
+
export class GroundOverlay extends React.PureComponent<GroundOverlayProps> {
|
|
12
|
+
private _cachedZIndex: number | undefined;
|
|
13
|
+
private _cachedStyle: any;
|
|
14
|
+
|
|
15
|
+
private getStyle(zIndex: number | undefined) {
|
|
16
|
+
if (zIndex == null) return styles.overlay;
|
|
17
|
+
if (zIndex !== this._cachedZIndex) {
|
|
18
|
+
this._cachedZIndex = zIndex;
|
|
19
|
+
this._cachedStyle = [{ zIndex }, styles.overlay];
|
|
20
|
+
}
|
|
21
|
+
return this._cachedStyle!;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
const { image, bounds, opacity, bearing, zIndex, onPress } = this.props;
|
|
26
|
+
const resolved = Image.resolveAssetSource(image);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<LuggGroundOverlayViewNativeComponent
|
|
30
|
+
style={this.getStyle(zIndex)}
|
|
31
|
+
image={resolved?.uri ?? ''}
|
|
32
|
+
bounds={bounds}
|
|
33
|
+
opacity={opacity}
|
|
34
|
+
bearing={bearing}
|
|
35
|
+
tappable={!!onPress}
|
|
36
|
+
onGroundOverlayPress={onPress}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
overlay: {
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
pointerEvents: 'none',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ImageSourcePropType } from 'react-native';
|
|
2
|
+
import type { Coordinate } from '../types';
|
|
3
|
+
|
|
4
|
+
export interface GroundOverlayBounds {
|
|
5
|
+
northeast: Coordinate;
|
|
6
|
+
southwest: Coordinate;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface GroundOverlayProps {
|
|
10
|
+
/**
|
|
11
|
+
* Image to overlay on the map
|
|
12
|
+
*/
|
|
13
|
+
image: ImageSourcePropType;
|
|
14
|
+
/**
|
|
15
|
+
* Geographic bounds for the overlay
|
|
16
|
+
*/
|
|
17
|
+
bounds: GroundOverlayBounds;
|
|
18
|
+
/**
|
|
19
|
+
* Opacity of the overlay (0-1)
|
|
20
|
+
*/
|
|
21
|
+
opacity?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Bearing (rotation) in degrees clockwise from north.
|
|
24
|
+
* Only supported on Google Maps.
|
|
25
|
+
* @platform google
|
|
26
|
+
*/
|
|
27
|
+
bearing?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Z-index for layering
|
|
30
|
+
*/
|
|
31
|
+
zIndex?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Called when the overlay is tapped
|
|
34
|
+
*/
|
|
35
|
+
onPress?: () => void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { useMapContext } from '../MapProvider.web';
|
|
3
|
+
import type { GroundOverlayProps } from './GroundOverlay.types';
|
|
4
|
+
|
|
5
|
+
export const GroundOverlay = ({
|
|
6
|
+
image,
|
|
7
|
+
bounds,
|
|
8
|
+
opacity = 1,
|
|
9
|
+
zIndex = 0,
|
|
10
|
+
onPress,
|
|
11
|
+
}: GroundOverlayProps) => {
|
|
12
|
+
const { map } = useMapContext();
|
|
13
|
+
const overlayRef = useRef<google.maps.GroundOverlay | null>(null);
|
|
14
|
+
const listenersRef = useRef<google.maps.MapsEventListener[]>([]);
|
|
15
|
+
|
|
16
|
+
const handleClick = useCallback(() => {
|
|
17
|
+
onPress?.();
|
|
18
|
+
}, [onPress]);
|
|
19
|
+
|
|
20
|
+
// Cleanup on unmount
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
return () => {
|
|
23
|
+
listenersRef.current.forEach((l) => l.remove());
|
|
24
|
+
listenersRef.current = [];
|
|
25
|
+
overlayRef.current?.setMap(null);
|
|
26
|
+
overlayRef.current = null;
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
// Sync listeners
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const overlay = overlayRef.current;
|
|
33
|
+
if (!overlay) return;
|
|
34
|
+
|
|
35
|
+
listenersRef.current.forEach((l) => l.remove());
|
|
36
|
+
listenersRef.current = [];
|
|
37
|
+
|
|
38
|
+
if (onPress) {
|
|
39
|
+
listenersRef.current.push(overlay.addListener('click', handleClick));
|
|
40
|
+
}
|
|
41
|
+
overlay.set('clickable', !!onPress);
|
|
42
|
+
}, [onPress, handleClick]);
|
|
43
|
+
|
|
44
|
+
// Sync overlay with props
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!map) {
|
|
47
|
+
overlayRef.current?.setMap(null);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const source =
|
|
52
|
+
typeof image === 'number'
|
|
53
|
+
? null
|
|
54
|
+
: Array.isArray(image)
|
|
55
|
+
? image[0]
|
|
56
|
+
: image;
|
|
57
|
+
const imageUrl = source?.uri ?? '';
|
|
58
|
+
if (!imageUrl) return;
|
|
59
|
+
|
|
60
|
+
const latLngBounds = new google.maps.LatLngBounds(
|
|
61
|
+
{ lat: bounds.southwest.latitude, lng: bounds.southwest.longitude },
|
|
62
|
+
{ lat: bounds.northeast.latitude, lng: bounds.northeast.longitude }
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// GroundOverlay bounds are immutable — recreate if bounds change
|
|
66
|
+
overlayRef.current?.setMap(null);
|
|
67
|
+
listenersRef.current.forEach((l) => l.remove());
|
|
68
|
+
listenersRef.current = [];
|
|
69
|
+
|
|
70
|
+
const overlay = new google.maps.GroundOverlay(imageUrl, latLngBounds, {
|
|
71
|
+
opacity,
|
|
72
|
+
clickable: !!onPress,
|
|
73
|
+
map,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
overlay.set('zIndex', zIndex);
|
|
77
|
+
overlayRef.current = overlay;
|
|
78
|
+
|
|
79
|
+
if (onPress) {
|
|
80
|
+
listenersRef.current.push(overlay.addListener('click', handleClick));
|
|
81
|
+
}
|
|
82
|
+
}, [map, image, bounds, opacity, zIndex, onPress, handleClick]);
|
|
83
|
+
|
|
84
|
+
return null;
|
|
85
|
+
};
|
|
@@ -3,6 +3,7 @@ import { StyleSheet } from 'react-native';
|
|
|
3
3
|
import LuggMarkerViewNativeComponent from '../fabric/LuggMarkerViewNativeComponent';
|
|
4
4
|
import LuggCalloutViewNativeComponent from '../fabric/LuggCalloutViewNativeComponent';
|
|
5
5
|
import type { MarkerProps } from './Marker.types';
|
|
6
|
+
import type { Point } from '../types';
|
|
6
7
|
|
|
7
8
|
export type {
|
|
8
9
|
CalloutOptions,
|
|
@@ -11,6 +12,8 @@ export type {
|
|
|
11
12
|
MarkerDragEvent,
|
|
12
13
|
} from './Marker.types';
|
|
13
14
|
|
|
15
|
+
const DEFAULT_ANCHOR: Point = { x: 0.5, y: 1 };
|
|
16
|
+
|
|
14
17
|
export class Marker extends React.PureComponent<MarkerProps> {
|
|
15
18
|
private getStyle(zIndex: number | undefined) {
|
|
16
19
|
if (zIndex == null) return styles.marker;
|
|
@@ -60,7 +63,7 @@ export class Marker extends React.PureComponent<MarkerProps> {
|
|
|
60
63
|
coordinate={coordinate}
|
|
61
64
|
title={title}
|
|
62
65
|
description={description}
|
|
63
|
-
anchor={anchor}
|
|
66
|
+
anchor={anchor ?? DEFAULT_ANCHOR}
|
|
64
67
|
rotate={rotate}
|
|
65
68
|
scale={scale}
|
|
66
69
|
rasterize={rasterize}
|
|
@@ -41,7 +41,10 @@ export interface MarkerProps {
|
|
|
41
41
|
*/
|
|
42
42
|
description?: string;
|
|
43
43
|
/**
|
|
44
|
-
* Anchor point for custom marker views
|
|
44
|
+
* Anchor point for custom marker views.
|
|
45
|
+
* `{x: 0.5, y: 1}` places the bottom-center of the marker at the coordinate.
|
|
46
|
+
*
|
|
47
|
+
* @default {x: 0.5, y: 1}
|
|
45
48
|
*/
|
|
46
49
|
anchor?: Point;
|
|
47
50
|
/**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import LuggTileOverlayViewNativeComponent from '../fabric/LuggTileOverlayViewNativeComponent';
|
|
4
|
+
import type { TileOverlayProps } from './TileOverlay.types';
|
|
5
|
+
|
|
6
|
+
export type { TileOverlayProps } from './TileOverlay.types';
|
|
7
|
+
|
|
8
|
+
export class TileOverlay extends React.PureComponent<TileOverlayProps> {
|
|
9
|
+
private _cachedZIndex: number | undefined;
|
|
10
|
+
private _cachedStyle: any;
|
|
11
|
+
|
|
12
|
+
private getStyle(zIndex: number | undefined) {
|
|
13
|
+
if (zIndex == null) return styles.overlay;
|
|
14
|
+
if (zIndex !== this._cachedZIndex) {
|
|
15
|
+
this._cachedZIndex = zIndex;
|
|
16
|
+
this._cachedStyle = [{ zIndex }, styles.overlay];
|
|
17
|
+
}
|
|
18
|
+
return this._cachedStyle!;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
render() {
|
|
22
|
+
const { urlTemplate, tileSize, opacity, bounds, zIndex, onPress } =
|
|
23
|
+
this.props;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<LuggTileOverlayViewNativeComponent
|
|
27
|
+
style={this.getStyle(zIndex)}
|
|
28
|
+
urlTemplate={urlTemplate}
|
|
29
|
+
tileSize={tileSize}
|
|
30
|
+
opacity={opacity}
|
|
31
|
+
bounds={bounds}
|
|
32
|
+
tappable={!!onPress}
|
|
33
|
+
onTileOverlayPress={onPress}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
overlay: {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
pointerEvents: 'none',
|
|
43
|
+
},
|
|
44
|
+
});
|