@mappedin/viewer 0.32.2-79d5869.0 → 0.32.2

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.32.2](https://github.com/MappedIn/viewer/compare/viewer-v0.32.1...viewer-v0.32.2) (2025-01-16)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **SRV-1964:** correct scale hover effect canvas with browser zoom ([#403](https://github.com/MappedIn/viewer/issues/403)) ([df422e5](https://github.com/MappedIn/viewer/commit/df422e5ad658a63fe8863d632adbaee7cec689c6))
9
+
3
10
  ## [0.32.1](https://github.com/MappedIn/viewer/compare/viewer-v0.32.0...viewer-v0.32.1) (2025-01-14)
4
11
 
5
12
 
package/dist/index.js CHANGED
@@ -17064,7 +17064,7 @@ const Cr2 = function() {
17064
17064
  const e = lg(), [t, r] = i;
17065
17065
  e.capture(t, r);
17066
17066
  }, vr2 = (i = {}) => {
17067
- const e = "phc_vZrwt3z6JmdPnErvTgZoazTAGlCRMiz6c2NqWtBt8qz", t = "https://ph-api.mappedin.com";
17067
+ const e = "phc_sRrjUwz9zicl4GeXtSnwcuKMr50SB76ma6NVi6zlPou", t = "https://ph-api.mappedin.com";
17068
17068
  B$2(i.captureEnabled ?? !0);
17069
17069
  const r = lg();
17070
17070
  if (!r.__loaded && e != null && t != null) {
@@ -74142,6 +74142,18 @@ class H6e {
74142
74142
  g2(this, "cursorPosition", { x: 0, y: 0 });
74143
74143
  g2(this, "enabled");
74144
74144
  g2(this, "frameCallback");
74145
+ g2(this, "handleResize", () => {
74146
+ this.updateCanvasResolution(this.containerRect.width, this.containerRect.height);
74147
+ });
74148
+ /**
74149
+ * Update the canvas resolution to account for high DPR devices. DPR lower than 1 should work
74150
+ * fine, but higher DPR's could cause blurriness without scaling.
74151
+ */
74152
+ g2(this, "updateCanvasResolution", (e, t) => {
74153
+ var n;
74154
+ const r = Math.max(devicePixelRatio, 1);
74155
+ this.canvas.width = e * r, this.canvas.height = t * r, this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`, (n = this.context) == null || n.scale(r, r);
74156
+ });
74145
74157
  /**
74146
74158
  * Scale the canvas whenever the container is resized.
74147
74159
  */
@@ -74151,7 +74163,7 @@ class H6e {
74151
74163
  if (r == null || (this.containerRect = r.target.getBoundingClientRect(), this.context == null))
74152
74164
  return;
74153
74165
  const { height: n, width: a } = r.contentRect;
74154
- this.canvas.height = n * devicePixelRatio, this.canvas.width = a * devicePixelRatio, this.canvas.style.height = `${n}px`, this.canvas.style.width = `${a}px`, this.context.scale(devicePixelRatio, devicePixelRatio);
74166
+ this.updateCanvasResolution(a, n);
74155
74167
  }).observe(this.container);
74156
74168
  });
74157
74169
  g2(this, "handleMouseMove", (e) => {
@@ -74164,7 +74176,7 @@ class H6e {
74164
74176
  * If enabled, draw a frame then request another frame draw.
74165
74177
  */
74166
74178
  g2(this, "startDrawing", () => {
74167
- this.enabled && this.context != null && (this.hasMouseMoved && this.frameCallback(this.context, this.canvas, this.cursorPosition), requestAnimationFrame(this.startDrawing));
74179
+ this.enabled && this.context != null && (this.hasMouseMoved && (this.clearCanvas(), this.frameCallback(this.context, this.canvas, this.cursorPosition)), requestAnimationFrame(this.startDrawing));
74168
74180
  });
74169
74181
  g2(this, "enable", () => {
74170
74182
  this.enabled || (this.enabled = !0, this.startDrawing());
@@ -74179,11 +74191,13 @@ class H6e {
74179
74191
  passive: !0
74180
74192
  }), document.addEventListener("mousedown", this.handleMouseMove, {
74181
74193
  passive: !0
74194
+ }), window.addEventListener("resize", this.handleResize, {
74195
+ passive: !0
74182
74196
  }), this.makeCanvasResponsive(), a.enabled && this.enable();
74183
74197
  }
74184
74198
  destroy() {
74185
74199
  var e;
74186
- this.disable(), this.canvas.remove(), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mousedown", this.handleMouseMove), (e = this.resizeObserver) == null || e.disconnect();
74200
+ this.disable(), this.canvas.remove(), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mousedown", this.handleMouseMove), window.removeEventListener("resize", this.handleResize), (e = this.resizeObserver) == null || e.disconnect();
74187
74201
  }
74188
74202
  }
74189
74203
  const O6e = 4;
@@ -74252,7 +74266,7 @@ const B6e = ({
74252
74266
  const p = w2.useCallback(
74253
74267
  (f, m, y) => {
74254
74268
  var E, A;
74255
- f.clearRect(0, 0, m.width, m.height), (E = h.current) == null || E.setPosition({ ...y }), f.save();
74269
+ (E = h.current) == null || E.setPosition({ ...y }), f.save();
74256
74270
  const g = ((A = h.current) == null ? void 0 : A.angle) ?? 0;
74257
74271
  f.transform(1, 0, 0, 1, y.x, y.y);
74258
74272
  const C = {
@@ -75036,7 +75050,7 @@ const f5e = (i, e) => (F4 != null || (cp == null && globalThis.OffscreenCanvas !
75036
75050
  const r = {
75037
75051
  fit: "fit",
75038
75052
  ...t
75039
- }, n = "https://image-proxy-staging.mappedin.net", a = g5e[e], s = encodeURIComponent(i);
75053
+ }, n = "https://image-proxy.mappedin.com", a = g5e[e], s = encodeURIComponent(i);
75040
75054
  return `${n}/resize:${r.fit}:${a}:${a}:0/plain/${s}`.replaceAll(/\/+/g, "/").replace("/", "//");
75041
75055
  }, GQ = le.div`
75042
75056
  display: flex;
@@ -76511,7 +76525,7 @@ class N5e {
76511
76525
  }
76512
76526
  async init(e) {
76513
76527
  this.container = e;
76514
- const t = this.rootStore.startupOptions.outdoorMapsKey ?? "f8fd42d9e1c2751f", r = {
76528
+ const t = this.rootStore.startupOptions.outdoorMapsKey ?? "zixaliyV5cGjHU", r = {
76515
76529
  auto: !1,
76516
76530
  initialFloor: this.rootStore.currentFloor,
76517
76531
  watermark: this.getWatermarkOptions(),
@@ -96615,7 +96629,7 @@ const Sge = ({ color: i = bl.color, changeFrequency: e = bl.changeFrequency, rad
96615
96629
  ] });
96616
96630
  }), MA2 = () => {
96617
96631
  let i = document.querySelector("meta[name=app-version]");
96618
- i == null && (i = document.createElement("meta"), i.name = "app-version", document.head.appendChild(i)), i.content = "0.32.1";
96632
+ i == null && (i = document.createElement("meta"), i.name = "app-version", document.head.appendChild(i)), i.content = "0.32.2";
96619
96633
  let e = document.querySelector("meta[name=viewport]");
96620
96634
  e == null && (e = document.createElement("meta"), e.name = "viewport", document.head.appendChild(e)), e.content = "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no";
96621
96635
  }, SA2 = (i) => {
@@ -16,6 +16,12 @@ declare class HighResCanvas {
16
16
  private enabled;
17
17
  private frameCallback;
18
18
  constructor(container: HTMLElement, frameCallback?: TCanvasFrameCallback, options?: THighResCanvasOptions);
19
+ private handleResize;
20
+ /**
21
+ * Update the canvas resolution to account for high DPR devices. DPR lower than 1 should work
22
+ * fine, but higher DPR's could cause blurriness without scaling.
23
+ */
24
+ private updateCanvasResolution;
19
25
  /**
20
26
  * Scale the canvas whenever the container is resized.
21
27
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/viewer",
3
- "version": "0.32.2-79d5869.0",
3
+ "version": "0.32.2",
4
4
  "type": "module",
5
5
  "browser": "./dist/index.js",
6
6
  "license": "UNLICENSED",