@mappedin/viewer 0.4.3-fca2cfa.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.0](https://github.com/MappedIn/viewer/compare/viewer-v0.4.2...viewer-v0.5.0) (2023-09-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * **MKR-331:** enable outdoor maps and be smarter about different ao settings ([#30](https://github.com/MappedIn/viewer/issues/30)) ([1d5cbc4](https://github.com/MappedIn/viewer/commit/1d5cbc462b3b77660f67bdbaed5c5d801dba89ce))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **MKR-328:** prevent user selecting the entire app on mobile ([#28](https://github.com/MappedIn/viewer/issues/28)) ([fca2cfa](https://github.com/MappedIn/viewer/commit/fca2cfa697a4f5a3115162fe249dfc963ae0977c))
14
+
3
15
  ## [0.4.2](https://github.com/MappedIn/viewer/compare/viewer-v0.4.1...viewer-v0.4.2) (2023-09-13)
4
16
 
5
17
 
@@ -1,4 +1,4 @@
1
- import { c as Zn, r as f } from "./index-38ccf2bd.js";
1
+ import { c as Zn, r as f } from "./index-a256c7f1.js";
2
2
  Zn();
3
3
  var dn = {}, Nn = f(function(t, n, r, e, i) {
4
4
  var a = new Worker(dn[n] || (dn[n] = URL.createObjectURL(new Blob([t + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'], { type: "text/javascript" }))));
@@ -9129,7 +9129,7 @@ const Ume = Bme`
9129
9129
  initialRotation: 0,
9130
9130
  minZoom: 200,
9131
9131
  pathSize: 0.25,
9132
- streetMapVisible: !1,
9132
+ streetMapVisible: !0,
9133
9133
  watermarkVisible: !0
9134
9134
  }
9135
9135
  }, jme = {
@@ -49295,7 +49295,7 @@ async function Nne(e) {
49295
49295
  throw new Error("Error parsing data! Unzipping failed.");
49296
49296
  if (e[Symbol.toStringTag] !== "Uint8Array")
49297
49297
  throw new Error("Unexpected file type! Unzipping failed.");
49298
- let r = (await import("./browser-JKMZVTUT-77fbc82a.js")).unzipSync(e);
49298
+ let r = (await import("./browser-JKMZVTUT-be479651.js")).unzipSync(e);
49299
49299
  if (!One(r))
49300
49300
  throw new Error("MVF is missing some expect static files. Unzipping failed.");
49301
49301
  let i = { "connection.json": r["connection.json"], "manifest.geojson": r["manifest.geojson"], "node.geojson": r["node.geojson"], "map.geojson": r["map.geojson"], "mapstack.geojson": r["mapstack.geojson"], "styles.json": r["styles.json"], space: {}, obstruction: {}, entrance: {} }, o = Object.keys(r);
@@ -57379,18 +57379,25 @@ var zq = class {
57379
57379
  m(zq, "MultiBufferRenderer"), me();
57380
57380
  var r4e = !1, Gie = class {
57381
57381
  constructor(e, t) {
57382
- ae(this, "core"), ae(this, "map"), ae(this, "enabled", !1), ae(this, "url", "https://tiles-cdn.mappedin.com/styles/mappedin/style.json"), ae(this, "authURL", "https://auth.mappedin.com/oauth2/token"), ae(this, "loaded", !1), ae(this, "module"), this.core = e, this.url = (t == null ? void 0 : t.url) || this.url, this.authURL = (t == null ? void 0 : t.authURL) || this.authURL;
57382
+ ae(this, "core"), ae(this, "map"), ae(this, "enabled", !1), ae(this, "url", "https://tiles-cdn.mappedin.com/styles/mappedin/style.json"), ae(this, "authURL", "https://auth.mappedin.com/oauth2/token"), ae(this, "headers"), ae(this, "loaded", !1), ae(this, "module"), ae(this, "getRequestHeaders", m(async () => {
57383
+ if (this.headers)
57384
+ return this.headers;
57385
+ {
57386
+ let { authURL: n } = this, r = await this.fetchToken(n), { access_token: i } = await r.json();
57387
+ return { "x-mappedin-tiles-key": i };
57388
+ }
57389
+ }, "getRequestHeaders")), this.core = e, this.url = (t == null ? void 0 : t.url) || this.url, this.authURL = (t == null ? void 0 : t.authURL) || this.authURL, this.headers = t == null ? void 0 : t.headers;
57383
57390
  }
57384
- fetchToken() {
57385
- return fetch(this.authURL, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ grant_type: "client_credentials", client_id: this.core.venue.options.clientId, client_secret: this.core.venue.options.clientSecret }) });
57391
+ fetchToken(e) {
57392
+ return fetch(e, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ grant_type: "client_credentials", client_id: this.core.venue.options.clientId, client_secret: this.core.venue.options.clientSecret }) });
57386
57393
  }
57387
57394
  async load() {
57388
57395
  try {
57389
- let e = await this.fetchToken(), { access_token: t } = await e.json();
57390
- this.module = await import("./outdoor-context-QN5FBZ37-1981265a.js");
57396
+ let [e, t] = await Promise.all([import("./outdoor-context-QN5FBZ37-61e6dfe0.js"), this.getRequestHeaders()]);
57397
+ this.module = e;
57391
57398
  let { Map: n, Marker: r } = this.module.default, i = document.createElement("div");
57392
57399
  Object.assign(i.style, { position: "absolute", top: "0px", left: "0px", width: "100%", height: "100%", pointerEvents: "none" }), this.core.container.appendChild(i);
57393
- let o = this.core.referenceMap.georeference[0].target.x, l = this.core.referenceMap.georeference[0].target.y, u = this.core.referenceMap.georeference[2].target.x, c = this.core.referenceMap.georeference[2].target.y, p = new Rn(o, l), f = new Rn(u, c), g = p.midpointTo(f), v = -Uf.radToDeg(this.core.controls.getRotation() + this.core.referenceMap.getNorth()), _ = Uf.radToDeg(this.core.controls.getTilt()), S = this.core.controls.getZoomLevel(), P = { canvas: this.core.renderer.domElement(), canvasContainer: i, container: this.core.container, style: this.url, center: [g.lon, g.lat], zoom: S, bearing: v, pitch: _, transformRequest: (I) => ({ url: I, headers: { "x-mappedin-tiles-key": t } }) };
57400
+ let o = this.core.referenceMap.georeference[0].target.x, l = this.core.referenceMap.georeference[0].target.y, u = this.core.referenceMap.georeference[2].target.x, c = this.core.referenceMap.georeference[2].target.y, p = new Rn(o, l), f = new Rn(u, c), g = p.midpointTo(f), v = -Uf.radToDeg(this.core.controls.getRotation() + this.core.referenceMap.getNorth()), _ = Uf.radToDeg(this.core.controls.getTilt()), S = this.core.controls.getZoomLevel(), P = { canvas: this.core.renderer.domElement(), canvasContainer: i, container: this.core.container, style: this.url, center: [g.lon, g.lat], zoom: S, bearing: v, pitch: _, transformRequest: (I) => ({ url: I, headers: t }) };
57394
57401
  this.map = new n(P), this.map.on("error", (I) => {
57395
57402
  bn.error(I);
57396
57403
  }), this.core.renderer.implementation.setOutdoorViewTexture(this.map.painter.webGLRenderTargetTexture), this.map.on("load", () => {
@@ -64246,33 +64253,44 @@ class cCe {
64246
64253
  const n = (r = t.find((i) => i.locations.length > 0)) == null ? void 0 : r.locations[0];
64247
64254
  return n != null && this.rootStore.setSelectedLocationId(n.id), !0;
64248
64255
  }
64256
+ getAOSettings() {
64257
+ let t = "medium", n = "full";
64258
+ return this.rootStore.isAppMobile ? (t = "medium", n = "half") : devicePixelRatio > 1 && (t = "low", n = "full"), {
64259
+ aoQuality: t,
64260
+ aoResolution: n
64261
+ };
64262
+ }
64249
64263
  get interactionMode() {
64250
64264
  return this.rootStore.departureMode === oi.DROPPED_PIN && this.rootStore.departure == null || this.directions.directions != null ? jv.CAMERA_ONLY : jv.DEFAULT;
64251
64265
  }
64252
64266
  async init(t) {
64253
- var i;
64267
+ var u;
64254
64268
  this.container = t;
64255
- const n = {
64269
+ const { aoQuality: n, aoResolution: r } = this.getAOSettings(), i = this.rootStore.uiStore.theme.map.streetMapVisible && !0, o = {
64256
64270
  aoEnabled: !0,
64257
- aoQuality: this.rootStore.isAppMobile ? "medium" : "performance",
64258
- aoResolution: this.rootStore.isAppMobile ? "half" : "full",
64271
+ antialias: !0,
64272
+ aoQuality: n,
64273
+ aoResolution: r,
64259
64274
  multiBufferRendering: !0,
64260
64275
  outdoorView: {
64261
- enabled: this.rootStore.uiStore.theme.map.streetMapVisible
64276
+ enabled: i,
64277
+ headers: {
64278
+ "x-mappedin-tiles-key": "f8fd42d9e1c2751f"
64279
+ }
64262
64280
  },
64263
- firstMap: (i = this.rootStore.currentMap) == null ? void 0 : i.id
64281
+ firstMap: (u = this.rootStore.currentMap) == null ? void 0 : u.id
64264
64282
  };
64265
64283
  this.rootStore.uiStore.theme.map.watermarkVisible && voe({
64266
64284
  position: this.rootStore.uiStore.logoPosition,
64267
64285
  padding: this.rootStore.isAppEmbedded ? 16 : 20,
64268
64286
  scale: this.rootStore.isAppEmbedded ? 1.5 : 1
64269
64287
  });
64270
- const r = await moe(t, this.rootStore.data, n);
64271
- r.Camera.minZoom = this.rootStore.uiStore.theme.map.minZoom, r.Camera.set({
64288
+ const l = await moe(t, this.rootStore.data, o);
64289
+ l.Camera.minZoom = this.rootStore.uiStore.theme.map.minZoom, l.Camera.set({
64272
64290
  tilt: this.rootStore.uiStore.theme.map.initialTilt,
64273
64291
  rotation: this.rootStore.uiStore.theme.map.initialRotation
64274
- }), r.setHoverColor(this.rootStore.uiStore.theme.colors.map.hover), r.setBackgroundColor(this.rootStore.uiStore.theme.colors.map.background), r.on(Kc.CLICK, this.handleMapClick), Zq(() => {
64275
- this.mapView = r;
64292
+ }), l.setHoverColor(this.rootStore.uiStore.theme.colors.map.hover), l.setBackgroundColor(this.rootStore.uiStore.theme.colors.map.background), l.on(Kc.CLICK, this.handleMapClick), Zq(() => {
64293
+ this.mapView = l;
64276
64294
  });
64277
64295
  }
64278
64296
  handleMapClick({ polygons: t }) {
@@ -67210,7 +67228,7 @@ class j6e {
67210
67228
  this.rootStore = t;
67211
67229
  }
67212
67230
  init() {
67213
- const t = "phc_vZrwt3z6JmdPnErvTgZoazTAGlCRMiz6c2NqWtBt8qz", n = "https://ph-api.mappedin.com";
67231
+ const t = "phc_sRrjUwz9zicl4GeXtSnwcuKMr50SB76ma6NVi6zlPou", n = "https://ph-api.mappedin.com";
67214
67232
  U6e.init(t, { api_host: n });
67215
67233
  }
67216
67234
  }
@@ -96280,7 +96298,7 @@ const R9e = Jr.div`
96280
96298
  ] });
96281
96299
  }), Spe = () => {
96282
96300
  const e = document.createElement("meta");
96283
- e.name = "app-version", e.content = "0.4.2", document.head.appendChild(e);
96301
+ e.name = "app-version", e.content = "0.5.0", document.head.appendChild(e);
96284
96302
  }, Mpe = (e) => {
96285
96303
  let t = e;
96286
96304
  if (t == null && (Tw.warn("options.root was not specified. Defaulting to #viewer-app-root."), t = document.getElementById("viewer-app-root")), t == null)