You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+66-28Lines changed: 66 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,11 +67,11 @@ MUST follow this end-to-end flow when wrapping a JS API into Kotlin:
67
67
- If a new return shape is required, extend `MTBridgeReturnType` in a focused change with tests.
68
68
69
69
5) Public API surface
70
-
- Add a thin convenience method on `MTMapViewController`(or appropriate worker/service) that:
70
+
- Add a thin convenience method on appropriate worker (NavigableWorker, ZoomableWorker etc.) and update `MTMapViewController`that uses it or StylableWorker and update MTStyle class that uses it:
71
71
- Ensures the map/style are ready (`ON_READY`).
72
72
- Validates inputs and applies sensible defaults.
73
73
- Launches on the appropriate coroutine scope and calls the bridge.
74
-
- Uses `suspend` functions for getters and `Result`/exceptions for failures where appropriate.
74
+
- Uses `suspend` functions for getters only and `Result`/exceptions for failures where appropriate.
75
75
76
76
6) Threading and lifecycle
77
77
- MUST execute JS on the main thread. `WebViewExecutor` already enforces `Dispatchers.Main`; do not bypass it.
@@ -84,32 +84,72 @@ MUST follow this end-to-end flow when wrapping a JS API into Kotlin:
84
84
Example skeleton:
85
85
86
86
```kotlin
87
-
@Serializable
88
-
privatedata classRotateToOptions(
89
-
valbearing:Double,
90
-
valduration:Double? = null,
91
-
)
92
-
93
-
internaldata classRotateTo(
94
-
privatevalbearing:Double,
95
-
privatevaldurationMs:Double? = null,
87
+
internaldata classFlyTo(
88
+
valcameraOptions:MTCameraOptions,
89
+
valflyToOptions:MTFlyToOptions? = null,
96
90
) : MTCommand {
97
91
overrideval isPrimitiveReturnType:Boolean=false
98
92
99
-
overridefuntoJS(): JSString {
100
-
val opts =RotateToOptions(bearing = bearing, duration = durationMs)
101
-
val json =JsonConfig.json.encodeToString(opts)
102
-
return"${MTBridge.MAP_OBJECT}.rotateTo($json);"
93
+
overridefuntoJS(): String {
94
+
val surrogate = getSurrogate(cameraOptions, flyToOptions)
95
+
val flyToString:JSString=JsonConfig.json.encodeToString(surrogate)
0 commit comments