venue-js 1.3.0-next.1 → 1.3.0-next.3
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/dist/index.js +27 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -405,6 +405,7 @@ var getOccupantMarkerLocations = (occupant, options) => {
|
|
|
405
405
|
var import_query_core = require("@tanstack/query-core");
|
|
406
406
|
|
|
407
407
|
// src/data/populator/index.ts
|
|
408
|
+
var import_lodash_es2 = require("lodash-es");
|
|
408
409
|
var import_boolean_within = require("@turf/boolean-within");
|
|
409
410
|
var createPopulator = ({
|
|
410
411
|
internalFindById,
|
|
@@ -488,7 +489,14 @@ var createPopulator = ({
|
|
|
488
489
|
const anchor = await internalFindById(kiosk.properties.anchor_id);
|
|
489
490
|
const units = await internalFilterByType("unit");
|
|
490
491
|
const unit = units.find(
|
|
491
|
-
(unit2) =>
|
|
492
|
+
(unit2) => {
|
|
493
|
+
try {
|
|
494
|
+
return unit2.properties.category === "walkway" && unit2.properties.level_id === kiosk.properties.level_id && (0, import_boolean_within.booleanWithin)(kiosk, unit2);
|
|
495
|
+
} catch (e) {
|
|
496
|
+
console.log(`Cannot find kiosk(${kiosk.id})'s units:`, e.message);
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
492
500
|
);
|
|
493
501
|
let section = null;
|
|
494
502
|
if (anchor) {
|
|
@@ -551,7 +559,7 @@ var createPopulator = ({
|
|
|
551
559
|
...occupant.properties,
|
|
552
560
|
anchor: anchor ? await populateAnchor(anchor) : null,
|
|
553
561
|
local_categories: await Promise.all(
|
|
554
|
-
localCategories.map(populateTaxonomy)
|
|
562
|
+
(0, import_lodash_es2.compact)(localCategories).map(populateTaxonomy)
|
|
555
563
|
),
|
|
556
564
|
venue,
|
|
557
565
|
promotions,
|
|
@@ -2729,7 +2737,7 @@ var CameraManager = class {
|
|
|
2729
2737
|
};
|
|
2730
2738
|
|
|
2731
2739
|
// src/IndoorMap/renderer/RendererManager.ts
|
|
2732
|
-
var
|
|
2740
|
+
var import_lodash_es4 = require("lodash-es");
|
|
2733
2741
|
var import_center3 = require("@turf/center");
|
|
2734
2742
|
var THREE3 = __toESM(require("three"));
|
|
2735
2743
|
|
|
@@ -2750,7 +2758,7 @@ var maptalks3 = __toESM(require("maptalks-gl"));
|
|
|
2750
2758
|
var import_maptalks6 = require("maptalks.three");
|
|
2751
2759
|
var import_three5 = require("three");
|
|
2752
2760
|
var import_d3plus_shape = require("d3plus-shape");
|
|
2753
|
-
var
|
|
2761
|
+
var import_lodash_es3 = require("lodash-es");
|
|
2754
2762
|
var OPTIONS3 = {
|
|
2755
2763
|
// Allowing click through and prevent interaction
|
|
2756
2764
|
interactive: false,
|
|
@@ -2768,9 +2776,9 @@ var defaultFlatLabelOptions = {
|
|
|
2768
2776
|
textBaseline: "middle",
|
|
2769
2777
|
fillStyle: "#000"
|
|
2770
2778
|
};
|
|
2771
|
-
var defaultRectAngleToCalc = (0,
|
|
2779
|
+
var defaultRectAngleToCalc = (0, import_lodash_es3.range)(-90, 92, 2);
|
|
2772
2780
|
var getMaterial = (text, flatLabelOptions) => {
|
|
2773
|
-
const options = (0,
|
|
2781
|
+
const options = (0, import_lodash_es3.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
|
|
2774
2782
|
const {
|
|
2775
2783
|
fontSize: initialFontSize,
|
|
2776
2784
|
fontFamily,
|
|
@@ -2823,12 +2831,12 @@ var getMaterial = (text, flatLabelOptions) => {
|
|
|
2823
2831
|
const maxWidth = SIZE - 2 * margin;
|
|
2824
2832
|
texts = wrapText(ctx, text, maxWidth);
|
|
2825
2833
|
}
|
|
2826
|
-
let textWidth = (0,
|
|
2834
|
+
let textWidth = (0, import_lodash_es3.max)(texts.map((text2) => ctx.measureText(text2).width));
|
|
2827
2835
|
let scale3 = 1;
|
|
2828
2836
|
while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
|
|
2829
2837
|
scale3 -= scaleStep;
|
|
2830
2838
|
ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
|
|
2831
|
-
textWidth = (0,
|
|
2839
|
+
textWidth = (0, import_lodash_es3.max)(texts.map((text2) => ctx.measureText(text2).width));
|
|
2832
2840
|
}
|
|
2833
2841
|
const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
|
|
2834
2842
|
if (scale3 > scaleMin) {
|
|
@@ -2896,7 +2904,7 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
|
|
|
2896
2904
|
strokeStyle,
|
|
2897
2905
|
lineWidth
|
|
2898
2906
|
});
|
|
2899
|
-
const rectAngles = (0,
|
|
2907
|
+
const rectAngles = (0, import_lodash_es3.isArray)(angle) ? angle : [angle];
|
|
2900
2908
|
material.needsUpdate = true;
|
|
2901
2909
|
const rect = (0, import_d3plus_shape.largestRect)(bound, {
|
|
2902
2910
|
cache: true,
|
|
@@ -2969,32 +2977,32 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
|
|
|
2969
2977
|
return { x: this.#offsetX, y: this.#offsetY };
|
|
2970
2978
|
}
|
|
2971
2979
|
set offsetX(value) {
|
|
2972
|
-
if ((0,
|
|
2980
|
+
if ((0, import_lodash_es3.isNumber)(value)) {
|
|
2973
2981
|
this.#offsetX = value;
|
|
2974
2982
|
this.#updatePosition();
|
|
2975
2983
|
}
|
|
2976
2984
|
}
|
|
2977
2985
|
set offsetY(value) {
|
|
2978
|
-
if ((0,
|
|
2986
|
+
if ((0, import_lodash_es3.isNumber)(value)) {
|
|
2979
2987
|
this.#offsetY = value;
|
|
2980
2988
|
this.#updatePosition();
|
|
2981
2989
|
}
|
|
2982
2990
|
}
|
|
2983
2991
|
set angle(newAngle) {
|
|
2984
|
-
if ((0,
|
|
2992
|
+
if ((0, import_lodash_es3.isNumber)(newAngle)) {
|
|
2985
2993
|
this.#angle = newAngle;
|
|
2986
2994
|
this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
|
|
2987
2995
|
}
|
|
2988
2996
|
}
|
|
2989
2997
|
setOffset(offsetX, offsetY) {
|
|
2990
|
-
if ((0,
|
|
2998
|
+
if ((0, import_lodash_es3.isNumber)(offsetX) && (0, import_lodash_es3.isNumber)(offsetY)) {
|
|
2991
2999
|
this.#offsetX = offsetX;
|
|
2992
3000
|
this.#offsetY = offsetY;
|
|
2993
3001
|
this.#updatePosition();
|
|
2994
3002
|
}
|
|
2995
3003
|
}
|
|
2996
3004
|
addOffset(deltaX, deltaY) {
|
|
2997
|
-
if ((0,
|
|
3005
|
+
if ((0, import_lodash_es3.isNumber)(deltaX) && (0, import_lodash_es3.isNumber)(deltaY)) {
|
|
2998
3006
|
this.#offsetX += deltaX;
|
|
2999
3007
|
this.#offsetY += deltaY;
|
|
3000
3008
|
this.#updatePosition();
|
|
@@ -4420,7 +4428,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4420
4428
|
if (this.#isClicked) return;
|
|
4421
4429
|
this.#isClicked = true;
|
|
4422
4430
|
const onClickElement = this.#onClickElement;
|
|
4423
|
-
if (!(0,
|
|
4431
|
+
if (!(0, import_lodash_es4.isFunction)(onClickElement)) return;
|
|
4424
4432
|
this.#onClickElement(e);
|
|
4425
4433
|
this.#isClicked = false;
|
|
4426
4434
|
};
|
|
@@ -4473,7 +4481,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4473
4481
|
});
|
|
4474
4482
|
units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
|
|
4475
4483
|
const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
|
|
4476
|
-
const roomOpenings = (0,
|
|
4484
|
+
const roomOpenings = (0, import_lodash_es4.compact)(openingRelationships.map((rel) => {
|
|
4477
4485
|
const openingId = rel?.properties.intermediary[0].id;
|
|
4478
4486
|
return openings.find((o) => o.id === openingId);
|
|
4479
4487
|
}));
|
|
@@ -4559,7 +4567,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4559
4567
|
this.markerRenderer.showMarkers(markers, ordinal - baseOrdinal);
|
|
4560
4568
|
}
|
|
4561
4569
|
} else {
|
|
4562
|
-
const baseOrdinal = Array.isArray(targetOrdinal) ? (0,
|
|
4570
|
+
const baseOrdinal = Array.isArray(targetOrdinal) ? (0, import_lodash_es4.min)(targetOrdinal) : targetOrdinal;
|
|
4563
4571
|
for (const [ordinal, elements] of this.elementsByOrdinal) {
|
|
4564
4572
|
const inOrdinal = Array.isArray(targetOrdinal) ? targetOrdinal.includes(ordinal) : ordinal === targetOrdinal;
|
|
4565
4573
|
if (inOrdinal) {
|
|
@@ -4586,7 +4594,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4586
4594
|
const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
|
|
4587
4595
|
elements.forEach((element) => {
|
|
4588
4596
|
const controller = this.elementRenderer.createHighlightController(element);
|
|
4589
|
-
if (controller && (0,
|
|
4597
|
+
if (controller && (0, import_lodash_es4.isFunction)(controller.start)) {
|
|
4590
4598
|
controller.start();
|
|
4591
4599
|
this.highlightControllers.push(controller);
|
|
4592
4600
|
}
|
|
@@ -4594,7 +4602,7 @@ var RendererManager = class extends EventTarget {
|
|
|
4594
4602
|
};
|
|
4595
4603
|
clearHighlightElements = () => {
|
|
4596
4604
|
this.highlightControllers.forEach((controller) => {
|
|
4597
|
-
if ((0,
|
|
4605
|
+
if ((0, import_lodash_es4.isFunction)(controller?.clear)) controller.clear();
|
|
4598
4606
|
});
|
|
4599
4607
|
};
|
|
4600
4608
|
/**
|