Added function to draw custom markers with Kotlin DSL Canvas API #1
@ -21,7 +21,6 @@ expect fun MapView(
|
|||||||
computeViewPoint: (canvasSize: DpSize) -> MapViewPoint,
|
computeViewPoint: (canvasSize: DpSize) -> MapViewPoint,
|
||||||
features: Map<FeatureId, MapFeature>,
|
features: Map<FeatureId, MapFeature>,
|
||||||
onClick: MapViewPoint.() -> Unit = {},
|
onClick: MapViewPoint.() -> Unit = {},
|
||||||
onFeatureClick: (FeatureId) -> Unit = {},
|
|
||||||
//TODO consider replacing by modifier
|
//TODO consider replacing by modifier
|
||||||
config: MapViewConfig = MapViewConfig(),
|
config: MapViewConfig = MapViewConfig(),
|
||||||
modifier: Modifier = Modifier.fillMaxSize(),
|
modifier: Modifier = Modifier.fillMaxSize(),
|
||||||
@ -33,14 +32,13 @@ fun MapView(
|
|||||||
initialViewPoint: MapViewPoint,
|
initialViewPoint: MapViewPoint,
|
||||||
features: Map<FeatureId, MapFeature> = emptyMap(),
|
features: Map<FeatureId, MapFeature> = emptyMap(),
|
||||||
onClick: MapViewPoint.() -> Unit = {},
|
onClick: MapViewPoint.() -> Unit = {},
|
||||||
onFeatureClick: (FeatureId) -> Unit = {},
|
|
||||||
config: MapViewConfig = MapViewConfig(),
|
config: MapViewConfig = MapViewConfig(),
|
||||||
modifier: Modifier = Modifier.fillMaxSize(),
|
modifier: Modifier = Modifier.fillMaxSize(),
|
||||||
buildFeatures: @Composable (FeatureBuilder.() -> Unit) = {},
|
buildFeatures: @Composable (FeatureBuilder.() -> Unit) = {},
|
||||||
) {
|
) {
|
||||||
val featuresBuilder = MapFeatureBuilder(features)
|
val featuresBuilder = MapFeatureBuilder(features)
|
||||||
featuresBuilder.buildFeatures()
|
featuresBuilder.buildFeatures()
|
||||||
MapView(mapTileProvider, { initialViewPoint }, featuresBuilder.build(), onClick, onFeatureClick, config, modifier)
|
MapView(mapTileProvider, { initialViewPoint }, featuresBuilder.build(), onClick, config, modifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -49,7 +47,6 @@ fun MapView(
|
|||||||
box: GmcBox,
|
box: GmcBox,
|
||||||
features: Map<FeatureId, MapFeature> = emptyMap(),
|
features: Map<FeatureId, MapFeature> = emptyMap(),
|
||||||
onClick: MapViewPoint.() -> Unit = {},
|
onClick: MapViewPoint.() -> Unit = {},
|
||||||
onFeatureClick: (FeatureId) -> Unit = {},
|
|
||||||
config: MapViewConfig = MapViewConfig(),
|
config: MapViewConfig = MapViewConfig(),
|
||||||
modifier: Modifier = Modifier.fillMaxSize(),
|
modifier: Modifier = Modifier.fillMaxSize(),
|
||||||
buildFeatures: @Composable (FeatureBuilder.() -> Unit) = {},
|
buildFeatures: @Composable (FeatureBuilder.() -> Unit) = {},
|
||||||
@ -65,5 +62,5 @@ fun MapView(
|
|||||||
)
|
)
|
||||||
MapViewPoint(box.center, zoom)
|
MapViewPoint(box.center, zoom)
|
||||||
}
|
}
|
||||||
MapView(mapTileProvider, computeViewPoint, featuresBuilder.build(), onClick, onFeatureClick, config, modifier)
|
MapView(mapTileProvider, computeViewPoint, featuresBuilder.build(), onClick, config, modifier)
|
||||||
}
|
}
|
@ -41,7 +41,6 @@ actual fun MapView(
|
|||||||
computeViewPoint: (canvasSize: DpSize) -> MapViewPoint,
|
computeViewPoint: (canvasSize: DpSize) -> MapViewPoint,
|
||||||
features: Map<FeatureId, MapFeature>,
|
features: Map<FeatureId, MapFeature>,
|
||||||
onClick: MapViewPoint.() -> Unit,
|
onClick: MapViewPoint.() -> Unit,
|
||||||
onFeatureClick: (FeatureId) -> Unit,
|
|
||||||
config: MapViewConfig,
|
config: MapViewConfig,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user