@aibee/crc-bmap 0.0.53 → 0.0.55
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/example/index.html +1 -0
- package/example/src/main.ts +13 -1
- package/lib/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +25 -0
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/config.d.ts +1 -0
- package/lib/src/context.d.ts +5 -0
- package/lib/src/elements/base-svg.d.ts +3 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -1393,8 +1393,21 @@ var BaseSvg = class extends EventDispatcher3 {
|
|
|
1393
1393
|
__publicField(this, "points", []);
|
|
1394
1394
|
__publicField(this, "svg");
|
|
1395
1395
|
__publicField(this, "enable", true);
|
|
1396
|
+
__publicField(this, "_onResize", ({ width, height }) => {
|
|
1397
|
+
if (this.svg) {
|
|
1398
|
+
this.svg.setAttribute("width", `${width}`);
|
|
1399
|
+
this.svg.setAttribute("height", `${height}`);
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1396
1402
|
this.svg = createSvg(`${context.container.clientWidth}`, `${context.container.clientHeight}`);
|
|
1397
1403
|
context.container.appendChild(this.svg);
|
|
1404
|
+
this._registryEvent();
|
|
1405
|
+
}
|
|
1406
|
+
_registryEvent() {
|
|
1407
|
+
this.context.addEventListener("resize", this._onResize);
|
|
1408
|
+
}
|
|
1409
|
+
_unRegistryEvent() {
|
|
1410
|
+
this.context.removeEventListener("resize", this._onResize);
|
|
1398
1411
|
}
|
|
1399
1412
|
setEnable(enable) {
|
|
1400
1413
|
this.enable = enable;
|
|
@@ -1419,6 +1432,7 @@ var BaseSvg = class extends EventDispatcher3 {
|
|
|
1419
1432
|
return coord;
|
|
1420
1433
|
}
|
|
1421
1434
|
dispose() {
|
|
1435
|
+
this._unRegistryEvent();
|
|
1422
1436
|
this.context.container.removeChild(this.svg);
|
|
1423
1437
|
this.svg = null;
|
|
1424
1438
|
}
|
|
@@ -2139,6 +2153,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
2139
2153
|
__publicField(this, "basicRatio");
|
|
2140
2154
|
// zoom=1的时候,100M对应的像素个数
|
|
2141
2155
|
__publicField(this, "materialFactory");
|
|
2156
|
+
__publicField(this, "observe", null);
|
|
2142
2157
|
__publicField(this, "clientSize", {
|
|
2143
2158
|
width: 0,
|
|
2144
2159
|
height: 0
|
|
@@ -2153,6 +2168,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
2153
2168
|
camera.updateProjectionMatrix();
|
|
2154
2169
|
renderer.setSize(w, h);
|
|
2155
2170
|
this.resizeClientSize(w, h);
|
|
2171
|
+
this.dispatchEvent({ type: "resize", width: w, height: h });
|
|
2156
2172
|
});
|
|
2157
2173
|
__publicField(this, "onClick", (e) => {
|
|
2158
2174
|
const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY);
|
|
@@ -2283,8 +2299,14 @@ var Context = class extends EventDispatcher6 {
|
|
|
2283
2299
|
this.container.addEventListener("pointerleave", this.onPointerleave);
|
|
2284
2300
|
this.selection.addEventListener("select", this.onSelectionSelect);
|
|
2285
2301
|
this.hoverHelper.addEventListener("hover-change", this.onHoverChange);
|
|
2302
|
+
if (this.config.mutationObserver) {
|
|
2303
|
+
const observe = new MutationObserver(this.onWindowResize);
|
|
2304
|
+
observe.observe(this.container, { attributes: true, attributeFilter: ["style"] });
|
|
2305
|
+
this.observe = observe;
|
|
2306
|
+
}
|
|
2286
2307
|
}
|
|
2287
2308
|
unRegistryEvent() {
|
|
2309
|
+
var _a;
|
|
2288
2310
|
window.removeEventListener("resize", this.onWindowResize);
|
|
2289
2311
|
this.container.removeEventListener("click", this.onClick);
|
|
2290
2312
|
this.container.removeEventListener("pointerover", this.onPointerover);
|
|
@@ -2292,6 +2314,8 @@ var Context = class extends EventDispatcher6 {
|
|
|
2292
2314
|
this.container.removeEventListener("pointerleave", this.onPointerleave);
|
|
2293
2315
|
this.selection.removeEventListener("select", this.onSelectionSelect);
|
|
2294
2316
|
this.hoverHelper.removeEventListener("hover-change", this.onHoverChange);
|
|
2317
|
+
(_a = this.observe) == null ? void 0 : _a.disconnect();
|
|
2318
|
+
this.observe = null;
|
|
2295
2319
|
}
|
|
2296
2320
|
/**
|
|
2297
2321
|
* 设置纵向旋转角度
|
|
@@ -2501,6 +2525,7 @@ var defaultConfig = {
|
|
|
2501
2525
|
floorGraphic: "/api/inception-map/floor/get",
|
|
2502
2526
|
floorRange: "/api/inception-map/range/get"
|
|
2503
2527
|
},
|
|
2528
|
+
mutationObserver: false,
|
|
2504
2529
|
heatMap: {
|
|
2505
2530
|
radius: 50,
|
|
2506
2531
|
gradient: {
|