diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-17 23:20:45 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-17 23:20:45 +0800 |
commit | 924864fc7434518ee0ae688f9be9d3086ba4b3f5 (patch) | |
tree | 578cc81e8aca85024efe06d47dfad98468490351 /addon | |
parent | 4dd0fa87859e6ffa1b230eedd1388098a8ba81a1 (diff) |
fix: don't apply dumbymap twice
Diffstat (limited to 'addon')
-rw-r--r-- | addon/index.mjs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/addon/index.mjs b/addon/index.mjs index 77716b6..4de11e0 100644 --- a/addon/index.mjs +++ b/addon/index.mjs | |||
@@ -34,10 +34,20 @@ const simpleRender = window.mapclay.renderWith(config => ({ | |||
34 | }, | 34 | }, |
35 | })) | 35 | })) |
36 | 36 | ||
37 | window.generateMaps(document.querySelector('main') ?? document.body, { | 37 | if (!document.querySelector('.Dumby')) { |
38 | crs: url.searchParams.get('crs') ?? 'EPSG:4326', | 38 | window.generateMaps(document.querySelector('main') ?? document.body, { |
39 | addBlocks, | 39 | crs: url.searchParams.get('crs') ?? 'EPSG:4326', |
40 | initialLayout: 'sticky', | 40 | addBlocks, |
41 | render: simpleRender, | 41 | initialLayout: 'sticky', |
42 | autoMap: true, | 42 | render: simpleRender, |
43 | autoMap: true, | ||
44 | }) | ||
45 | } | ||
46 | |||
47 | new window.MutationObserver((ms) => { | ||
48 | for (const m of ms) { | ||
49 | console.log(m) | ||
50 | } | ||
51 | }).observe(document.querySelector('#doc'), { | ||
52 | childList: true, | ||
43 | }) | 53 | }) |