@geolonia/embed 3.1.4 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/embed",
3
- "version": "3.1.4",
3
+ "version": "3.2.0",
4
4
  "description": "Geolonia embed JS API",
5
5
  "main": "dist/embed.js",
6
6
  "types": "src/embed.d.ts",
@@ -54,6 +54,7 @@
54
54
  "@turf/center": "^6.0.1",
55
55
  "core-js": "^3.26.1",
56
56
  "maplibre-gl": "2.4.0",
57
+ "pmtiles": "^2.7.2",
57
58
  "promise-polyfill": "^8.2.3",
58
59
  "sanitize-html": "^2.8.0",
59
60
  "tinycolor2": "^1.4.1",
package/src/embed.js CHANGED
@@ -13,6 +13,10 @@ import parseAtts from './lib/parse-atts';
13
13
  import { parseApiKey } from './lib/parse-api-key';
14
14
  import pkg from '../package.json';
15
15
  import SimpleStyle from './lib/simplestyle';
16
+ import * as pmtiles from 'pmtiles';
17
+
18
+ const protocol = new pmtiles.Protocol();
19
+ maplibregl.addProtocol('pmtiles', protocol.tile);
16
20
 
17
21
  if ( util.checkPermission() ) {
18
22
  let isDOMContentLoaded = false;
package/src/lib/util.js CHANGED
@@ -103,14 +103,10 @@ export function getLang() {
103
103
  * Detects the window is scrollable.
104
104
  */
105
105
  export function isScrollable() {
106
- const { height: bodyHeight } = document.body.getBoundingClientRect();
107
- const windowHeight = window.innerHeight;
106
+ const body = document.body;
107
+ const html = document.documentElement;
108
108
 
109
- if (bodyHeight > windowHeight) {
110
- return true;
111
- } else {
112
- return false;
113
- }
109
+ return body.scrollHeight > body.clientHeight || html.scrollHeight > html.clientHeight;
114
110
  }
115
111
 
116
112
  /**
@@ -202,7 +198,7 @@ export function getOptions(container, params, atts) {
202
198
  pitch: parseFloat(atts.pitch),
203
199
  zoom: parseFloat(atts.zoom),
204
200
  hash: (atts.hash === 'on'),
205
- localIdeographFontFamily: 'sans-serif',
201
+ localIdeographFontFamily: undefined,
206
202
  attributionControl: false,
207
203
  };
208
204