diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-16 16:57:47 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-16 18:57:18 +0800 |
commit | 1caf56dc0a2bbf4bb484fe4f312b5229a63aace3 (patch) | |
tree | 913a3e5803e9d4128d0ad6d8bd6ed64326d5e5d4 /addon/index.mjs | |
parent | 9c90bd1cbdc5de5b50def0eb4cb3e65e80194af3 (diff) |
feat: add simple script to test mapclay
* add more options for generateMaps for general purposes
* add rollup config for adding script into addon
Diffstat (limited to 'addon/index.mjs')
-rw-r--r-- | addon/index.mjs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/addon/index.mjs b/addon/index.mjs new file mode 100644 index 0000000..323edf1 --- /dev/null +++ b/addon/index.mjs | |||
@@ -0,0 +1,17 @@ | |||
1 | const { Leaflet } = window.mapclay.renderers | ||
2 | const simpleRender = window.mapclay.renderWith(config => ({ | ||
3 | use: 'Leaflet', | ||
4 | width: '100%', | ||
5 | height: '200px', | ||
6 | XYZ: 'https://tile.openstreetmap.jp/styles/osm-bright/512/{z}/{x}/{y}.png', | ||
7 | ...config, | ||
8 | aliases: { | ||
9 | use: { Leaflet }, | ||
10 | ...(config.aliases ?? {}), | ||
11 | }, | ||
12 | })) | ||
13 | |||
14 | window.generateMaps(document.querySelector('main') ?? document.body, { | ||
15 | initialLayout: '', | ||
16 | render: simpleRender, | ||
17 | }) | ||