File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
kmp-maps/core/src/commonMain/kotlin/com/swmansion/kmpmaps/core Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -204,9 +204,9 @@ public fun Polyline.getId(): String = "polyline_${hashCode()}"
204204/* *
205205 * Represents the camera position and orientation of the map.
206206 *
207- * At least one of [coordinates] or [bounds] should be provided to position the camera :
208- * - When [bounds] is set, the camera zooms to fit the entire region regardless of [zoom].
209- * - When only [coordinates] is set, [zoom] controls the zoom level (defaults to 0 if null ).
207+ * **Configuration Rules:** To successfully initialize, you must provide either :
208+ * 1. Both [coordinates] **and** [zoom].
209+ * 2. Or [bounds] (which takes precedence for positioning ).
210210 *
211211 * @property coordinates The center coordinates of the camera view, or null to use [bounds] center
212212 * @property zoom The zoom level of the map (typically 0–20), or null to use default (0)
@@ -221,7 +221,13 @@ public data class CameraPosition(
221221 val bounds : MapBounds ? = null ,
222222 val androidCameraPosition : AndroidCameraPosition ? = null ,
223223 val iosCameraPosition : IosCameraPosition ? = null ,
224- )
224+ ) {
225+ init {
226+ require((coordinates != null && zoom != null ) || bounds != null ) {
227+ " CameraPosition requires at least one of 'coordinates' or 'bounds' to be set."
228+ }
229+ }
230+ }
225231
226232/* *
227233 * Represents a group of markers that have been combined into a single cluster.
You can’t perform that action at this time.
0 commit comments