Skip to content

Commit 69bfe72

Browse files
RD-962: Add JS bundle resources (#6)
1 parent e9854d9 commit 69bfe72

File tree

7 files changed

+1074
-10
lines changed

7 files changed

+1074
-10
lines changed

.idea/deploymentTargetSelector.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
- This script is designed to be used within WebView to interact with the native Kotlin.
3+
- It does not use ES Modules or TypeScript to ensure compatibility with non-module environments.
4+
*/
5+
6+
function setUpMapEvents(map) {
7+
// BRIDGE - Error event propagation
8+
map.on('error', function(error) {
9+
// Placeholder - error propagation
10+
});
11+
12+
// BRIDGE - WebGL event propagation
13+
map.on('webglcontextlost', function() {
14+
// Placeholder - event propagation
15+
});
16+
17+
// BRIDGE - Map events propagation
18+
19+
const events = [
20+
'boxzoomcancel',
21+
'boxzoomend',
22+
'boxzoomstart',
23+
'contextmenu',
24+
'cooperativegestureprevented',
25+
'dblclick',
26+
'idle',
27+
'load',
28+
'loadWithTerrain',
29+
'move',
30+
'moveend',
31+
'movestart',
32+
'pitch',
33+
'pitchend',
34+
'pitchstart',
35+
'projectiontransition',
36+
'ready',
37+
'remove',
38+
'render',
39+
'resize',
40+
'terrain',
41+
'terrainAnimationStart',
42+
'terrainAnimationStop'
43+
];
44+
45+
events.forEach(event => {
46+
map.on(event, function() {
47+
// Placeholder - event propagation
48+
});
49+
});
50+
51+
// MapTapEvent
52+
map.on('click', function(e) {
53+
var data = {
54+
lngLat: e.lngLat,
55+
point: e.point
56+
};
57+
58+
// Placeholder - event propagation
59+
});
60+
61+
// MapImageEvent
62+
map.on('styleimagemissing', function(e) {
63+
var data = {
64+
id: e.id,
65+
};
66+
67+
// Placeholder - event propagation
68+
});
69+
70+
// MapDataEvents
71+
const mapDataEvents = [
72+
'data',
73+
'dataabort',
74+
'dataloading',
75+
'sourcedata',
76+
'sourcedataabort',
77+
'sourcedataloading',
78+
'styledata',
79+
'styledataloading',
80+
'rotate',
81+
'rotateend',
82+
'rotatestart'
83+
];
84+
85+
mapDataEvents.forEach(event => {
86+
map.on(event, function(e) {
87+
var data = {
88+
dataType: e.dataType,
89+
isSourceLoaded: e.isSourceLoaded,
90+
source: e.source,
91+
sourceDataType: e.sourceDataType,
92+
tile: e.tile,
93+
coord: e.coord
94+
};
95+
96+
// Placeholder - event propagation
97+
});
98+
});
99+
100+
// MapTouchEvents
101+
const mapTouchEvents = [
102+
'touchcancel',
103+
'touchend',
104+
'touchmove',
105+
'touchstart',
106+
'drag',
107+
'dragend',
108+
'dragstart',
109+
'zoom',
110+
'zoomend',
111+
'zoomstart'
112+
];
113+
114+
mapTouchEvents.forEach(event => {
115+
map.on(event, function(e) {
116+
var data = {
117+
lngLat: e.lngLat,
118+
lngLats: e.lngLats,
119+
point: e.point,
120+
points: e.points
121+
};
122+
123+
// Placeholder - event propagation
124+
});
125+
});
126+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
- This script is designed to be used within WebView to interact with the native Kotlin.
3+
- It does not use ES Modules or TypeScript to ensure compatibility with non-module environments.
4+
*/
5+
6+
function initializeMap(apiKey, style, options, session) {
7+
maptilersdk.config.apiKey = apiKey;
8+
maptilersdk.config.session = session;
9+
10+
const baseOptions = {
11+
container: 'map',
12+
style: style
13+
}
14+
15+
const mapOptions = {...baseOptions, ...options}
16+
const map = new maptilersdk.Map(mapOptions);
17+
18+
setUpMapEvents(map);
19+
window.map = map;
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>MapTiler Map</title>
7+
<script src="maptiler-sdk.umd.min.js"></script>
8+
<link href="maptiler-sdk.css" rel="stylesheet" />
9+
<style>
10+
body { margin: 0; padding: 0; }
11+
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
12+
</style>
13+
</head>
14+
<body>
15+
<div id="map"></div>
16+
<script src="MapInit.js" ></script>
17+
<script src="MapEventSetUp.js" ></script>
18+
</body>
19+
</html>

MapTilerSDK/src/main/assets/maptiler-sdk.css

Lines changed: 176 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MapTilerSDK/src/main/assets/maptiler-sdk.umd.min.js

Lines changed: 732 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MapTilerSDK/src/main/assets/maptiler-sdk.umd.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)