@mappedin/maplibre-overlay 6.17.1-beta.0 → 6.19.0-beta.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/README.md +5 -4
- package/lib/esm/index.d.ts +1 -27
- package/lib/esm/index.js +229 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -103,12 +103,13 @@ initializeMap();
|
|
|
103
103
|
|
|
104
104
|
### Notes
|
|
105
105
|
|
|
106
|
-
Set `centerClampedToGround: false` when using multi-floor view
|
|
106
|
+
Set `centerClampedToGround: false` when using multi-floor view\*\* — MapLibre defaults `centerClampedToGround` to `true`, which resets the camera elevation to 0 every frame. This prevents floor elevation changes from taking effect. You MUST set this option when constructing the MapLibre map if you enable `multiFloorView`:
|
|
107
|
+
|
|
107
108
|
```typescript
|
|
108
109
|
const map = new MapLibreMap({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
container: 'map',
|
|
111
|
+
centerClampedToGround: false, // required for multi-floor view
|
|
112
|
+
// ...other options
|
|
112
113
|
});
|
|
113
114
|
```
|
|
114
115
|
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -14,32 +14,6 @@ import { IControl } from "maplibre-gl";
|
|
|
14
14
|
* @experimental
|
|
15
15
|
*/
|
|
16
16
|
declare const createMapLibreOverlay: (mapData: MapData, showMapOptions?: TShow3DMapOptions) => MappedinMapLibreOverlay;
|
|
17
|
-
declare const FLOOR_GAP = 3;
|
|
18
|
-
/**
|
|
19
|
-
* Default map options used if no custom options are provided.
|
|
20
|
-
*
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
declare const DEFAULT_MAP_OPTIONS: {
|
|
24
|
-
debug: false;
|
|
25
|
-
pitch: number;
|
|
26
|
-
bearing: number;
|
|
27
|
-
antialiasing: {
|
|
28
|
-
enabled: true;
|
|
29
|
-
};
|
|
30
|
-
shadingAndOutlines: true;
|
|
31
|
-
outdoorView: {
|
|
32
|
-
layersHiddenByGeometry: string[];
|
|
33
|
-
};
|
|
34
|
-
imagePlacementOptions: {
|
|
35
|
-
mode: "default";
|
|
36
|
-
};
|
|
37
|
-
flipImagesToFaceCamera: true;
|
|
38
|
-
multiFloorView: {
|
|
39
|
-
enabled: false;
|
|
40
|
-
floorGap: number;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
17
|
type TMappedinMapLibreOverlayEvents = {
|
|
44
18
|
/**
|
|
45
19
|
* Event emitted when the MappedinMap is loaded
|
|
@@ -202,4 +176,4 @@ declare class MappedinMapLibreOverlay implements IControl {
|
|
|
202
176
|
} ? TMappedinMapLibreOverlayEvents[EventName]["data"] : TMappedinMapLibreOverlayEvents[EventName]) => void) => void;
|
|
203
177
|
}
|
|
204
178
|
//#endregion
|
|
205
|
-
export {
|
|
179
|
+
export { MappedinMapLibreOverlay, TMappedinMapLibreOverlayEvents, createMapLibreOverlay };
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1,229 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M=Object.defineProperty;var T=i=>{throw TypeError(i)};var C=(i,t,e)=>t in i?M(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var a=(i,t)=>M(i,"name",{value:t,configurable:!0});var y=(i,t,e)=>C(i,typeof t!="symbol"?t+"":t,e),N=(i,t,e)=>t.has(i)||T("Cannot "+e);var o=(i,t,e)=>(N(i,t,"read from private field"),e?e.call(i):t.get(i)),m=(i,t,e)=>t.has(i)?T("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),b=(i,t,e,r)=>(N(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e);var u={env:{NODE_ENV:"production",npm_package_version:"6.19.0-beta.0"}};import{MapView as H}from"@mappedin/mappedin-js";import{__INTERNAL__MapLibreOverlay as $,__INTERNAL__convertToRendererCoreOptions as j}from"@mappedin/mappedin-js";var _=class _{_subscribers={};_abortController=new AbortController;get signal(){return this._abortController.signal}publish(t,e){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(r){typeof r=="function"&&r(e)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,e,r){let n=r?.signal;if(n?.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let s=a(()=>{this.off(t,e)},"cleanup");return n&&n.addEventListener("abort",s,{once:!0}),s}off(t,e){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let r=this._subscribers[t].indexOf(e);r!==-1&&this._subscribers[t].splice(r,1)}destroy(){this.signal.aborted||(this._subscribers={},this._abortController.abort())}};a(_,"PubSub");var x=_;var O=a((i,{id:t}={})=>{let e=Array.isArray(i)?i:[i];if(!e.every(s=>typeof s=="string"))return;let r=e.join(""),n=null;if(t){let s=document.getElementById(t);s instanceof HTMLStyleElement&&(n=s)}n==null&&(n=document.createElement("style")),t&&t!==""&&(n.id=t),n.textContent=r,document.head.appendChild(n)},"injectCSS");var R="[MappedinJS]";function v(i="",{prefix:t=R}={}){let e=`${t}${i?`-${i}`:""}`,r=a((n,s)=>{if(typeof window<"u"&&window.rnDebug){let k=s.map(E=>E instanceof Error&&E.stack?`${E.message}
|
|
2
|
+
${E.stack}`:E);window.rnDebug(`${i} ${n}: ${k.join(" ")}`)}},"rnDebug");return{logState:u.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(e,...n),r("log",n))},warn(...n){this.logState<=1&&(console.warn(e,...n),r("warn",n))},error(...n){this.logState<=2&&(console.error(e,...n),r("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}a(v,"createLogger");var tt=v();var L=v("",{prefix:"[MapLibreOverlay]"});var A=`.mappedin-marker {
|
|
3
|
+
font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
top: 0;
|
|
6
|
+
position: absolute;
|
|
7
|
+
font-weight: bold;
|
|
8
|
+
color: black;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
will-change: transform, opacity;
|
|
12
|
+
transition: opacity 150ms ease-in-out;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Opt out of CSS opacity transitions when the marker has animated: false.
|
|
18
|
+
* Without this, direct style.opacity assignments (from DOMDrawSystem's snap
|
|
19
|
+
* path and from onStrategySelected) still fade over the CSS transition
|
|
20
|
+
* duration, and during that fade \`marker.animation\` is null so the transform
|
|
21
|
+
* update path is skipped \u2014 causing markers to drift if the camera is moving.
|
|
22
|
+
*/
|
|
23
|
+
.mappedin-marker[data-animated='false'] {
|
|
24
|
+
transition: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Low priority pin strategy styles */
|
|
28
|
+
|
|
29
|
+
/* Hide child elements as well */
|
|
30
|
+
.mappedin-marker[data-placement='hidden'] > .mappedin-marker-content {
|
|
31
|
+
visibility: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Create the pin using ::before pseudo-element */
|
|
35
|
+
.mappedin-marker::before {
|
|
36
|
+
content: '';
|
|
37
|
+
display: none;
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
position: relative;
|
|
40
|
+
/* Default values - will be overridden by inline styles */
|
|
41
|
+
width: var(--mappedin-pin-size, 2px);
|
|
42
|
+
height: var(--mappedin-pin-size, 2px);
|
|
43
|
+
background-color: var(--pin-color, #666);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.mappedin-marker[data-placement='hidden']::before {
|
|
47
|
+
display: block;
|
|
48
|
+
}
|
|
49
|
+
`;var w=`.mappedin__smart-collision-engine__container {
|
|
50
|
+
position: absolute;
|
|
51
|
+
left: 0px;
|
|
52
|
+
top: 0px;
|
|
53
|
+
bottom: 0px;
|
|
54
|
+
right: 0px;
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
/* Establishes a stacking context so inner z-indexed canvases stay scoped
|
|
57
|
+
* here, and lifts the wrapper above the WebGL canvas (which carries
|
|
58
|
+
* \`z-index: 1\` as a webkit compositing workaround). */
|
|
59
|
+
z-index: 1;
|
|
60
|
+
font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.mappedin__smart-collision-engine-debug__container {
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: 0px;
|
|
66
|
+
top: 0px;
|
|
67
|
+
bottom: 0px;
|
|
68
|
+
right: 0px;
|
|
69
|
+
transition: opacity 300ms ease-in-out;
|
|
70
|
+
pointer-events: none;
|
|
71
|
+
will-change: opacity;
|
|
72
|
+
&.interacting {
|
|
73
|
+
opacity: 0.2;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`;var S=`.mappedin-map {
|
|
77
|
+
.mappedin-interactive {
|
|
78
|
+
cursor: grab;
|
|
79
|
+
|
|
80
|
+
&:active {
|
|
81
|
+
cursor: grabbing;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.mappedin-interaction-hover {
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;var V=`.mappedin-map {
|
|
90
|
+
.mappedin-control-container {
|
|
91
|
+
position: absolute;
|
|
92
|
+
left: 0px;
|
|
93
|
+
top: 0px;
|
|
94
|
+
bottom: 0px;
|
|
95
|
+
right: 0px;
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;
|
|
98
|
+
|
|
99
|
+
.mappedin-ctrl-top-left,
|
|
100
|
+
.mappedin-ctrl-top-right,
|
|
101
|
+
.mappedin-ctrl-bottom-left,
|
|
102
|
+
.mappedin-ctrl-bottom-right {
|
|
103
|
+
position: absolute;
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.mappedin-ctrl-top-left {
|
|
108
|
+
top: 0;
|
|
109
|
+
left: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.mappedin-ctrl-top-right {
|
|
113
|
+
top: 0;
|
|
114
|
+
right: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.mappedin-ctrl-bottom-left {
|
|
118
|
+
bottom: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.mappedin-ctrl-bottom-right {
|
|
123
|
+
bottom: 0;
|
|
124
|
+
right: 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.mappedin-ctrl-attrib {
|
|
128
|
+
display: block;
|
|
129
|
+
position: relative;
|
|
130
|
+
pointer-events: auto;
|
|
131
|
+
font: 9px/11px 'InterUI-Regular', Helvetica, Arial, sans-serif;
|
|
132
|
+
padding: 3px 5px 1px 5px;
|
|
133
|
+
background-color: rgba(255, 255, 255, 0.5);
|
|
134
|
+
margin: 0;
|
|
135
|
+
min-width: 11px;
|
|
136
|
+
min-height: 11px;
|
|
137
|
+
user-select: none;
|
|
138
|
+
|
|
139
|
+
summary.mappedin-ctrl-attrib-button {
|
|
140
|
+
appearance: none;
|
|
141
|
+
list-style: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
summary.mappedin-ctrl-attrib-button::-webkit-details-marker {
|
|
145
|
+
display: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&.mappedin-compact .mappedin-ctrl-attrib-button,
|
|
149
|
+
&.mappedin-compact-show .mappedin-ctrl-attrib-inner {
|
|
150
|
+
display: inline-block;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.mappedin-compact {
|
|
154
|
+
background-color: transparent;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&.mappedin-compact-show {
|
|
158
|
+
min-width: 15px;
|
|
159
|
+
min-height: 15px;
|
|
160
|
+
box-sizing: border-box;
|
|
161
|
+
background-color: rgba(255, 255, 255, 0.5);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.mappedin-ctrl-attrib-top-left {
|
|
166
|
+
float: left;
|
|
167
|
+
border-bottom-right-radius: 4px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.mappedin-ctrl-attrib-top-right {
|
|
171
|
+
float: right;
|
|
172
|
+
border-bottom-left-radius: 4px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.mappedin-ctrl-attrib-bottom-left {
|
|
176
|
+
float: left;
|
|
177
|
+
border-top-right-radius: 4px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.mappedin-ctrl-attrib-bottom-right {
|
|
181
|
+
float: right;
|
|
182
|
+
border-top-left-radius: 4px;
|
|
183
|
+
}
|
|
184
|
+
.mappedin-ctrl-attrib-top-left,
|
|
185
|
+
.mappedin-ctrl-attrib-bottom-left {
|
|
186
|
+
padding: 3px 5px 1px 20px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.mappedin-ctrl-attrib-inner {
|
|
190
|
+
display: inline-block;
|
|
191
|
+
margin-right: 12px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.mappedin-ctrl-attrib-inner,
|
|
195
|
+
.mappedin-ctrl-attrib-inner a {
|
|
196
|
+
color: rgba(0, 0, 0, 0.75);
|
|
197
|
+
text-decoration: none;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.mappedin-ctrl-attrib-inner-bold,
|
|
201
|
+
.mappedin-ctrl-attrib-inner-bold a {
|
|
202
|
+
font-weight: bold;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.mappedin-ctrl-attrib-inner a:hover {
|
|
206
|
+
color: #017ef1;
|
|
207
|
+
text-decoration: underline;
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.mappedin-ctrl-attrib-button {
|
|
212
|
+
display: none;
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
position: absolute;
|
|
215
|
+
width: 15px;
|
|
216
|
+
height: 15px;
|
|
217
|
+
box-sizing: border-box;
|
|
218
|
+
border-radius: 50%;
|
|
219
|
+
top: 0;
|
|
220
|
+
right: 2px;
|
|
221
|
+
border: 1px;
|
|
222
|
+
}
|
|
223
|
+
.mappedin-ctrl-attrib-top-left .mappedin-ctrl-attrib-button,
|
|
224
|
+
.mappedin-ctrl-attrib-bottom-left .mappedin-ctrl-attrib-button {
|
|
225
|
+
left: 2px;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
`;var U=3,D={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!1,floorGap:U}},F=[A,w,S,V],_t=a((i,t)=>{f.instance!=null&&L.warn("Only a single map venue is supported at this time.");let e=new f([i.mapCenter.longitude,i.mapCenter.latitude],i,t);return f.instance=e,e},"createMapLibreOverlay"),l,d,h,p,c,g=class g{constructor(t,e,r){m(this,l);m(this,d);m(this,h);m(this,p);m(this,c);y(this,"on",a((t,e)=>{o(this,l).on(t,e)},"on"));y(this,"off",a((t,e)=>{o(this,l).off(t,e)},"off"));b(this,l,new x),b(this,c,new $(t,j(r))),b(this,d,e),b(this,h,r)}onAdd(t){let e=o(this,c).onAdd(t),r={...D,...o(this,h)??{},outdoorView:{...D.outdoorView,token:o(this,d).outdoorViewToken,...o(this,h)?.outdoorView}};return b(this,p,new H(o(this,c).core)),(r.injectStyles??!0)&&O(F,{id:"mappedin__styles"}),o(this,p).addMap(o(this,d),r).then(()=>{o(this,l).publish("loaded",{mapView:o(this,p),mapData:o(this,d)})}).catch(n=>{L.error("Failed to initialize indoor map",n)}),e}onRemove(){o(this,p)&&o(this,p).clear(),g.instance=null,o(this,c).onRemove()}};l=new WeakMap,d=new WeakMap,h=new WeakMap,p=new WeakMap,c=new WeakMap,a(g,"MappedinMapLibreOverlay"),y(g,"instance");var f=g;export{f as MappedinMapLibreOverlay,_t as createMapLibreOverlay};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mappedin/maplibre-overlay",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.19.0-beta.0",
|
|
4
4
|
"homepage": "https://developer.mappedin.com/",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/esm/index.js",
|
|
@@ -17,19 +17,18 @@
|
|
|
17
17
|
"dependencies": {},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"maplibre-gl": "^5.6.0",
|
|
20
|
-
"@mappedin/mappedin-js": "^6.
|
|
20
|
+
"@mappedin/mappedin-js": "^6.19.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {},
|
|
23
23
|
"volta": {
|
|
24
24
|
"extends": "../../package.json"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"start": "pnpm build && concurrently \"node scripts/build.mjs --watchChanges\" \"node scripts/start.mjs\"",
|
|
28
27
|
"build": "pnpm clean && pnpm types && node scripts/build.mjs",
|
|
29
28
|
"build:prod": "cross-env NODE_ENV=production pnpm build",
|
|
30
29
|
"types": "tsc -b tsconfig.build.json",
|
|
31
|
-
"test": "
|
|
32
|
-
"test:cov": "
|
|
30
|
+
"test": "jest --config jest.config.js",
|
|
31
|
+
"test:cov": "pnpm test --coverage",
|
|
33
32
|
"version:ci": "pnpm version --no-commit-hooks --no-git-tag-version",
|
|
34
33
|
"clean": "rm -rf lib/** && rm -rf examples/dist/**",
|
|
35
34
|
"docs": "pnpm build && pnpm docs:build",
|