@nika-js/onlymap 0.8.0 → 0.8.1

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
@@ -8,6 +8,15 @@ Note: npm collapsed a few closely-spaced releases — the GPX/FlatGeobuf (0.5.4)
8
8
  and GeoParquet (0.5.5) work shipped to npm together as **0.5.6**, so npm's
9
9
  version list jumps 0.5.3 → 0.5.6. Each logical version is listed here regardless.
10
10
 
11
+ ## 0.8.1 — 2026-09-18
12
+
13
+ ### Fixed
14
+ - **A frame that used to show a captured image no longer shows it behind a live map.** Switching a cartograph frame back to live left its old capture drawing underneath, so the map appeared to have a ghost of itself behind it at low tilt. The capture is kept — switching back to static restores it — but it stays out of sight while the frame is live.
15
+ - **A frame can no longer be tilted past the point where it stops working.** Tilt far enough and a frame's top edge reaches the horizon, which leaves it with no georeference — and without that, no scale bar, no north arrow, no graticule and no export. The tilt now stops at whatever that frame can still handle, which depends on its shape and zoom: a wide frame tilts further than a tall one, and zooming in lets both tilt further.
16
+
17
+ ### Added
18
+ - **`max-pitch` on `<om-map>`** caps how far a map can be tilted, in degrees. Useful for a kiosk or an embedded map that should stay roughly upright. It is applied to the controls, so an over-tilt is simply refused rather than snapping back after the fact.
19
+
11
20
  ## 0.8.0 — 2026-09-11
12
21
 
13
22
  ### Added
@@ -19,7 +19,7 @@ async function v(N = {}) {
19
19
  if (n) {
20
20
  const { createRequire: I } = await import(
21
21
  /*webpackIgnore:true*/
22
- "./lerc-D7TfTy6l.js"
22
+ "./lerc-BdHcL8pi.js"
23
23
  ).then((g) => g._);
24
24
  var O = I(import.meta.url);
25
25
  }
@@ -1,4 +1,4 @@
1
- import { C as ny, L as sy, M as oy, m as ay, c as ka, a as Sd, z as oc, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-BGOblzWN.js";
1
+ import { C as ny, L as sy, M as oy, m as ay, c as ka, a as Sd, z as oc, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-D6R4z3Zs.js";
2
2
  const Cd = Math.PI / 180, gy = 180 / Math.PI;
3
3
  function em(Pe, K = 0) {
4
4
  const pe = Math.min(180, Pe) * Cd;
@@ -25321,6 +25321,16 @@ class Ry {
25321
25321
  setInteractive(K) {
25322
25322
  K.doubleClickZoom === !1 ? this.map.doubleClickZoom.disable() : K.doubleClickZoom === !0 && this.map.doubleClickZoom.enable(), K.dragPan === !1 ? this.map.dragPan.disable() : K.dragPan === !0 && this.map.dragPan.enable();
25323
25323
  }
25324
+ /**
25325
+ * Cap how far the user can tilt. Null restores MapLibre's own maximum.
25326
+ *
25327
+ * A cap belongs on the CONTROLLER, not on the camera: clamping a pitch after
25328
+ * the gesture has produced it means the view visibly overshoots and springs
25329
+ * back, while a controller maximum simply refuses to go further.
25330
+ */
25331
+ setMaxPitch(K) {
25332
+ this.map.setMaxPitch(K ?? 85);
25333
+ }
25324
25334
  isLoaded() {
25325
25335
  return this.initialized;
25326
25336
  }
package/dist/basemap.d.ts CHANGED
@@ -154,6 +154,14 @@ export declare class MapLibreBasemapAdapter {
154
154
  doubleClickZoom?: boolean;
155
155
  dragPan?: boolean;
156
156
  }): void;
157
+ /**
158
+ * Cap how far the user can tilt. Null restores MapLibre's own maximum.
159
+ *
160
+ * A cap belongs on the CONTROLLER, not on the camera: clamping a pitch after
161
+ * the gesture has produced it means the view visibly overshoots and springs
162
+ * back, while a controller maximum simply refuses to go further.
163
+ */
164
+ setMaxPitch(maxPitch: number | null): void;
157
165
  isLoaded(): boolean;
158
166
  getViewport(): ViewportLike;
159
167
  getViewState(): BasemapViewState;
@@ -29,7 +29,7 @@ export { deriveLegendRows, readOverrides, readLiteralRows, swatchShapeFor, rowCo
29
29
  export { buildGraticule, niceInterval, formatDms, GEOGRAPHIC_PLANE, type Graticule, type GridPlane } from "./graticule";
30
30
  export { lintLegendColours, simulate, deltaE00, parseColor, ensureCvdFilters, applyCvdToCanvas, resolveCvdType, CVD_TYPES, CVD_VALUES, CVD_MATRICES, COLLAPSE_THRESHOLD, type CvdType, type LegendColourLint, type ColourCollapse, } from "./cvd";
31
31
  export { loadCore, setCoreLoader, peekCore, isCoreLoaded, type CoreModule } from "./core-loader";
32
- export { cornersFromCamera, readCamera, sanitizeAdoptedMap, type FrameCamera, type Corners } from "./live-frame";
32
+ export { cornersFromCamera, maxGeoreferenceablePitch, readCamera, sanitizeAdoptedMap, type FrameCamera, type Corners } from "./live-frame";
33
33
  export { renderCartograph, renderCartographAtlas, MAX_CANVAS_AREA, MAX_CANVAS_DIMENSION, type RenderCartographOptions, type RenderCartographResult, type RenderAtlasOptions, type RenderAtlasResult, } from "./render";
34
34
  export { buildPages, featureBounds, padBounds, boundsArea, atlasFields, fieldOf, parseSort, sanitizeFilename, resolveFilenames, rejectionFor, type AtlasFeature, type AtlasRejection, } from "./atlas";
35
35
  export { createZip, type ZipFile } from "./zip";
@@ -65,6 +65,16 @@ export declare class OmFrameElement extends CartographElementBase implements Car
65
65
  private updateLiveCorners;
66
66
  private mountLive;
67
67
  private sizeLiveMap;
68
+ /**
69
+ * Stop the adopted map tilting past what this frame can georeference.
70
+ *
71
+ * A frame without a georeference has no scale bar, no north arrow, no
72
+ * graticule and no export — so letting a host drive the camera past the
73
+ * limit produces a frame that renders an error instead of a map. The ceiling
74
+ * is the frame's own, recomputed whenever its box changes, because it
75
+ * depends on the box's aspect and the current zoom.
76
+ */
77
+ private capMapPitch;
68
78
  /**
69
79
  * Draw another frame's footprint on this one. The outline is DENSIFIED —
70
80
  * sampled along each edge and projected point by point — because a
@@ -45,6 +45,20 @@ export declare function readCamera(el: Element): FrameCamera | null;
45
45
  * a huge number that looks like a coordinate — is what lets the frame mark
46
46
  * itself degenerate and the furniture refuse to draw.
47
47
  */
48
+ /**
49
+ * The steepest pitch this frame can still georeference, in whole degrees.
50
+ *
51
+ * There is no constant to use here. The corners are unprojected through the
52
+ * frame's OWN box, so the ceiling moves with its aspect and the zoom: a wide
53
+ * frame tilts further than a tall one, and zooming in raises the limit again.
54
+ * A fixed 45° or 60° would be wrong in both directions — too strict on the
55
+ * frames that could tilt, too lax on the ones that cannot.
56
+ *
57
+ * Coarse then fine: the answer only needs to be whole degrees, and each probe
58
+ * is four unprojections, so this is a handful of microseconds rather than
59
+ * something worth caching.
60
+ */
61
+ export declare function maxGeoreferenceablePitch(core: CoreModule, camera: FrameCamera, widthPx: number, heightPx: number, ceiling?: number): number;
48
62
  export declare function cornersFromCamera(core: CoreModule, camera: FrameCamera, widthPx: number, heightPx: number): Corners | null;
49
63
  /** Load the core and build an `<om-map>` for a frame, from `src=` or an inline child. */
50
64
  export declare function buildLiveMap(frame: Element): Promise<{