@mappedin/viewer 0.4.3-4fe0339.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-3104bb35.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" }))));
@@ -9068,9 +9068,18 @@ const Ume = Bme`
9068
9068
  body {
9069
9069
  margin: 0;
9070
9070
  height: 100%;
9071
+
9072
+ // Disable press-and-hold selection on mobile
9073
+ -webkit-touch-callout:none;
9074
+ -webkit-user-select:none;
9075
+ -khtml-user-select:none;
9076
+ -moz-user-select:none;
9077
+ -ms-user-select:none;
9078
+ user-select:none;
9079
+ -webkit-tap-highlight-color:rgba(0,0,0,0);
9071
9080
  }
9072
9081
 
9073
- div#viewer-app-root {
9082
+ div.viewer-app-root {
9074
9083
  height: 100%;
9075
9084
  width: 100%;
9076
9085
  }
@@ -9120,7 +9129,7 @@ const Ume = Bme`
9120
9129
  initialRotation: 0,
9121
9130
  minZoom: 200,
9122
9131
  pathSize: 0.25,
9123
- streetMapVisible: !1,
9132
+ streetMapVisible: !0,
9124
9133
  watermarkVisible: !0
9125
9134
  }
9126
9135
  }, jme = {
@@ -49286,7 +49295,7 @@ async function Nne(e) {
49286
49295
  throw new Error("Error parsing data! Unzipping failed.");
49287
49296
  if (e[Symbol.toStringTag] !== "Uint8Array")
49288
49297
  throw new Error("Unexpected file type! Unzipping failed.");
49289
- let r = (await import("./browser-JKMZVTUT-985f0479.js")).unzipSync(e);
49298
+ let r = (await import("./browser-JKMZVTUT-be479651.js")).unzipSync(e);
49290
49299
  if (!One(r))
49291
49300
  throw new Error("MVF is missing some expect static files. Unzipping failed.");
49292
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);
@@ -57370,18 +57379,25 @@ var zq = class {
57370
57379
  m(zq, "MultiBufferRenderer"), me();
57371
57380
  var r4e = !1, Gie = class {
57372
57381
  constructor(e, t) {
57373
- 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;
57374
57390
  }
57375
- fetchToken() {
57376
- 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 }) });
57377
57393
  }
57378
57394
  async load() {
57379
57395
  try {
57380
- let e = await this.fetchToken(), { access_token: t } = await e.json();
57381
- this.module = await import("./outdoor-context-QN5FBZ37-880bf2b0.js");
57396
+ let [e, t] = await Promise.all([import("./outdoor-context-QN5FBZ37-61e6dfe0.js"), this.getRequestHeaders()]);
57397
+ this.module = e;
57382
57398
  let { Map: n, Marker: r } = this.module.default, i = document.createElement("div");
57383
57399
  Object.assign(i.style, { position: "absolute", top: "0px", left: "0px", width: "100%", height: "100%", pointerEvents: "none" }), this.core.container.appendChild(i);
57384
- 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 }) };
57385
57401
  this.map = new n(P), this.map.on("error", (I) => {
57386
57402
  bn.error(I);
57387
57403
  }), this.core.renderer.implementation.setOutdoorViewTexture(this.map.painter.webGLRenderTargetTexture), this.map.on("load", () => {
@@ -64237,33 +64253,44 @@ class cCe {
64237
64253
  const n = (r = t.find((i) => i.locations.length > 0)) == null ? void 0 : r.locations[0];
64238
64254
  return n != null && this.rootStore.setSelectedLocationId(n.id), !0;
64239
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
+ }
64240
64263
  get interactionMode() {
64241
64264
  return this.rootStore.departureMode === oi.DROPPED_PIN && this.rootStore.departure == null || this.directions.directions != null ? jv.CAMERA_ONLY : jv.DEFAULT;
64242
64265
  }
64243
64266
  async init(t) {
64244
- var i;
64267
+ var u;
64245
64268
  this.container = t;
64246
- const n = {
64269
+ const { aoQuality: n, aoResolution: r } = this.getAOSettings(), i = this.rootStore.uiStore.theme.map.streetMapVisible && !0, o = {
64247
64270
  aoEnabled: !0,
64248
- aoQuality: "medium",
64249
- aoResolution: "half",
64271
+ antialias: !0,
64272
+ aoQuality: n,
64273
+ aoResolution: r,
64250
64274
  multiBufferRendering: !0,
64251
64275
  outdoorView: {
64252
- enabled: this.rootStore.uiStore.theme.map.streetMapVisible
64276
+ enabled: i,
64277
+ headers: {
64278
+ "x-mappedin-tiles-key": "f8fd42d9e1c2751f"
64279
+ }
64253
64280
  },
64254
- firstMap: (i = this.rootStore.currentMap) == null ? void 0 : i.id
64281
+ firstMap: (u = this.rootStore.currentMap) == null ? void 0 : u.id
64255
64282
  };
64256
64283
  this.rootStore.uiStore.theme.map.watermarkVisible && voe({
64257
64284
  position: this.rootStore.uiStore.logoPosition,
64258
64285
  padding: this.rootStore.isAppEmbedded ? 16 : 20,
64259
64286
  scale: this.rootStore.isAppEmbedded ? 1.5 : 1
64260
64287
  });
64261
- const r = await moe(t, this.rootStore.data, n);
64262
- 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({
64263
64290
  tilt: this.rootStore.uiStore.theme.map.initialTilt,
64264
64291
  rotation: this.rootStore.uiStore.theme.map.initialRotation
64265
- }), 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(() => {
64266
- 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;
64267
64294
  });
64268
64295
  }
64269
64296
  handleMapClick({ polygons: t }) {
@@ -67201,7 +67228,7 @@ class j6e {
67201
67228
  this.rootStore = t;
67202
67229
  }
67203
67230
  init() {
67204
- const t = "phc_vZrwt3z6JmdPnErvTgZoazTAGlCRMiz6c2NqWtBt8qz", n = "https://ph-api.mappedin.com";
67231
+ const t = "phc_sRrjUwz9zicl4GeXtSnwcuKMr50SB76ma6NVi6zlPou", n = "https://ph-api.mappedin.com";
67205
67232
  U6e.init(t, { api_host: n });
67206
67233
  }
67207
67234
  }
@@ -67835,7 +67862,14 @@ const dTe = ({
67835
67862
  t.cleanup();
67836
67863
  };
67837
67864
  }, [n]), /* @__PURE__ */ He.jsxs(He.Fragment, { children: [
67838
- /* @__PURE__ */ He.jsx("div", { id: "maker-map", ref: r, style: { height: "100%", width: "100%", position: "absolute" } }),
67865
+ /* @__PURE__ */ He.jsx(
67866
+ "div",
67867
+ {
67868
+ id: "maker-map",
67869
+ ref: r,
67870
+ style: { height: "100%", width: "100%", position: "absolute", userSelect: "none" }
67871
+ }
67872
+ ),
67839
67873
  /* @__PURE__ */ He.jsx("div", { style: { height: "100%", width: "100%", position: "absolute", pointerEvents: "none" }, children: /* @__PURE__ */ He.jsx(
67840
67874
  gTe,
67841
67875
  {
@@ -96264,12 +96298,12 @@ const R9e = Jr.div`
96264
96298
  ] });
96265
96299
  }), Spe = () => {
96266
96300
  const e = document.createElement("meta");
96267
- 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);
96268
96302
  }, Mpe = (e) => {
96269
96303
  let t = e;
96270
96304
  if (t == null && (Tw.warn("options.root was not specified. Defaulting to #viewer-app-root."), t = document.getElementById("viewer-app-root")), t == null)
96271
96305
  throw new Error("Could not find #viewer-app-root. Please add it to your HTML file.");
96272
- return t;
96306
+ return t.classList.contains("viewer-app-root") || t.classList.add("viewer-app-root"), t;
96273
96307
  }, LRe = (e) => {
96274
96308
  const t = Mpe(e.root);
96275
96309
  Spe(), Ub.createRoot(t).render(/* @__PURE__ */ He.jsx(Epe, { ...e }));