@classic-homes/maps-core 0.2.3 → 0.2.5
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.cjs +416 -48
- package/dist/index.d.cts +292 -46
- package/dist/index.d.ts +292 -46
- package/dist/index.js +411 -44
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1469,49 +1469,6 @@ function filterByGeometryType(geojson, types) {
|
|
|
1469
1469
|
};
|
|
1470
1470
|
}
|
|
1471
1471
|
|
|
1472
|
-
// src/utils/positioning.ts
|
|
1473
|
-
var BASE_OFFSET = 8;
|
|
1474
|
-
var POSITION_CLASSES = {
|
|
1475
|
-
"top-left": "top-2 left-2",
|
|
1476
|
-
"top-right": "top-2 right-2",
|
|
1477
|
-
"bottom-left": "bottom-2 left-2",
|
|
1478
|
-
"bottom-right": "bottom-2 right-2"
|
|
1479
|
-
};
|
|
1480
|
-
var OFFSET_CLASSES = {
|
|
1481
|
-
"top-left": "left-14",
|
|
1482
|
-
// Offset right (toward center)
|
|
1483
|
-
"top-right": "right-14",
|
|
1484
|
-
// Offset left (toward center)
|
|
1485
|
-
"bottom-left": "left-14",
|
|
1486
|
-
// Offset right (toward center)
|
|
1487
|
-
"bottom-right": "right-14"
|
|
1488
|
-
// Offset left (toward center)
|
|
1489
|
-
};
|
|
1490
|
-
function computePositionClasses(position, hasControlsAtPosition) {
|
|
1491
|
-
const base = POSITION_CLASSES[position];
|
|
1492
|
-
if (!hasControlsAtPosition) {
|
|
1493
|
-
return base;
|
|
1494
|
-
}
|
|
1495
|
-
const offset = OFFSET_CLASSES[position];
|
|
1496
|
-
if (position.includes("left")) {
|
|
1497
|
-
return base.replace("left-2", offset);
|
|
1498
|
-
}
|
|
1499
|
-
if (position.includes("right")) {
|
|
1500
|
-
return base.replace("right-2", offset);
|
|
1501
|
-
}
|
|
1502
|
-
return base;
|
|
1503
|
-
}
|
|
1504
|
-
function computeVerticalOffsetStyle(position, customControlOffset, baseOffset = BASE_OFFSET) {
|
|
1505
|
-
if (customControlOffset <= 0) {
|
|
1506
|
-
return {};
|
|
1507
|
-
}
|
|
1508
|
-
const totalOffset = `${baseOffset + customControlOffset}px`;
|
|
1509
|
-
if (position.includes("top")) {
|
|
1510
|
-
return { top: totalOffset };
|
|
1511
|
-
}
|
|
1512
|
-
return { bottom: totalOffset };
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
1472
|
// src/utils/cluster.ts
|
|
1516
1473
|
function isClusterFeature(feature) {
|
|
1517
1474
|
return feature.properties !== null && feature.properties !== void 0 && typeof feature.properties === "object" && "cluster_id" in feature.properties && "point_count" in feature.properties;
|
|
@@ -3855,6 +3812,416 @@ function getLayersWithErrors(states) {
|
|
|
3855
3812
|
return Array.from(states.values()).filter((state) => state.error !== null);
|
|
3856
3813
|
}
|
|
3857
3814
|
|
|
3815
|
+
// src/positioning/types.ts
|
|
3816
|
+
var Z_INDEX_LAYERS = {
|
|
3817
|
+
base: 10,
|
|
3818
|
+
interactive: 20,
|
|
3819
|
+
expanded: 30,
|
|
3820
|
+
modal: 40,
|
|
3821
|
+
tooltip: 50
|
|
3822
|
+
};
|
|
3823
|
+
var PRIORITY_ORDER = ["low", "normal", "high", "critical"];
|
|
3824
|
+
var STACK_GAP = 8;
|
|
3825
|
+
var EDGE_MARGIN = 8;
|
|
3826
|
+
var ATTRIBUTION_HEIGHT = 32;
|
|
3827
|
+
|
|
3828
|
+
// src/positioning/PositioningCoordinator.ts
|
|
3829
|
+
var PositioningCoordinator = class {
|
|
3830
|
+
constructor() {
|
|
3831
|
+
/** Registered controls */
|
|
3832
|
+
this.controls = /* @__PURE__ */ new Map();
|
|
3833
|
+
/** Computed offsets for each control */
|
|
3834
|
+
this.offsets = /* @__PURE__ */ new Map();
|
|
3835
|
+
/** Current map dimensions */
|
|
3836
|
+
this.mapDimensions = { width: 0, height: 0 };
|
|
3837
|
+
/** Event listeners */
|
|
3838
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
3839
|
+
/** Batch update flag to defer layout recalculation */
|
|
3840
|
+
this.batchingUpdates = false;
|
|
3841
|
+
/** Pending recalculation flag during batching */
|
|
3842
|
+
this.pendingRecalculation = false;
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Register a control with the coordinator
|
|
3846
|
+
*
|
|
3847
|
+
* @param registration - Control registration data
|
|
3848
|
+
* @returns Computed offset for the control, or null if registration failed
|
|
3849
|
+
*/
|
|
3850
|
+
register(registration) {
|
|
3851
|
+
if (this.controls.has(registration.id)) {
|
|
3852
|
+
console.warn(
|
|
3853
|
+
`PositioningCoordinator: Control "${registration.id}" is already registered. Use update() to modify.`
|
|
3854
|
+
);
|
|
3855
|
+
return this.offsets.get(registration.id) || null;
|
|
3856
|
+
}
|
|
3857
|
+
this.controls.set(registration.id, { ...registration });
|
|
3858
|
+
this.recalculateLayout();
|
|
3859
|
+
this.emit("control-registered", registration.id);
|
|
3860
|
+
return this.offsets.get(registration.id) || null;
|
|
3861
|
+
}
|
|
3862
|
+
/**
|
|
3863
|
+
* Unregister a control from the coordinator
|
|
3864
|
+
*
|
|
3865
|
+
* @param controlId - ID of the control to unregister
|
|
3866
|
+
*/
|
|
3867
|
+
unregister(controlId) {
|
|
3868
|
+
if (!this.controls.has(controlId)) {
|
|
3869
|
+
return;
|
|
3870
|
+
}
|
|
3871
|
+
this.controls.delete(controlId);
|
|
3872
|
+
this.offsets.delete(controlId);
|
|
3873
|
+
this.recalculateLayout();
|
|
3874
|
+
this.emit("control-unregistered", controlId);
|
|
3875
|
+
}
|
|
3876
|
+
/**
|
|
3877
|
+
* Update a control's registration
|
|
3878
|
+
*
|
|
3879
|
+
* @param controlId - ID of the control to update
|
|
3880
|
+
* @param updates - Partial registration updates
|
|
3881
|
+
* @returns Updated offset, or null if control not found
|
|
3882
|
+
*/
|
|
3883
|
+
update(controlId, updates) {
|
|
3884
|
+
const existing = this.controls.get(controlId);
|
|
3885
|
+
if (!existing) {
|
|
3886
|
+
console.warn(`PositioningCoordinator: Cannot update unregistered control "${controlId}"`);
|
|
3887
|
+
return null;
|
|
3888
|
+
}
|
|
3889
|
+
this.controls.set(controlId, { ...existing, ...updates });
|
|
3890
|
+
this.recalculateLayout();
|
|
3891
|
+
this.emit("control-updated", controlId);
|
|
3892
|
+
return this.offsets.get(controlId) || null;
|
|
3893
|
+
}
|
|
3894
|
+
/**
|
|
3895
|
+
* Set the expanded state of a control
|
|
3896
|
+
*
|
|
3897
|
+
* @param controlId - ID of the control
|
|
3898
|
+
* @param isExpanded - Whether the control is expanded
|
|
3899
|
+
* @returns Updated offset, or null if control not found
|
|
3900
|
+
*/
|
|
3901
|
+
setExpanded(controlId, isExpanded) {
|
|
3902
|
+
return this.update(controlId, { isExpanded });
|
|
3903
|
+
}
|
|
3904
|
+
/**
|
|
3905
|
+
* Set the map dimensions for layout calculations
|
|
3906
|
+
*
|
|
3907
|
+
* @param dimensions - New map dimensions
|
|
3908
|
+
*/
|
|
3909
|
+
setMapDimensions(dimensions) {
|
|
3910
|
+
if (dimensions.width === this.mapDimensions.width && dimensions.height === this.mapDimensions.height) {
|
|
3911
|
+
return;
|
|
3912
|
+
}
|
|
3913
|
+
this.mapDimensions = { ...dimensions };
|
|
3914
|
+
this.recalculateLayout();
|
|
3915
|
+
this.emit("map-resized");
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* Get the current offset for a control
|
|
3919
|
+
*
|
|
3920
|
+
* @param controlId - ID of the control
|
|
3921
|
+
* @returns Current offset, or null if not found
|
|
3922
|
+
*/
|
|
3923
|
+
getOffset(controlId) {
|
|
3924
|
+
return this.offsets.get(controlId) || null;
|
|
3925
|
+
}
|
|
3926
|
+
/**
|
|
3927
|
+
* Get all current offsets
|
|
3928
|
+
*
|
|
3929
|
+
* @returns Map of control IDs to offsets
|
|
3930
|
+
*/
|
|
3931
|
+
getAllOffsets() {
|
|
3932
|
+
return new Map(this.offsets);
|
|
3933
|
+
}
|
|
3934
|
+
/**
|
|
3935
|
+
* Subscribe to coordinator events
|
|
3936
|
+
*
|
|
3937
|
+
* @param listener - Event listener function
|
|
3938
|
+
* @returns Unsubscribe function
|
|
3939
|
+
*/
|
|
3940
|
+
subscribe(listener) {
|
|
3941
|
+
this.listeners.add(listener);
|
|
3942
|
+
return () => {
|
|
3943
|
+
this.listeners.delete(listener);
|
|
3944
|
+
};
|
|
3945
|
+
}
|
|
3946
|
+
/**
|
|
3947
|
+
* Start batching updates to defer layout recalculation
|
|
3948
|
+
* Call endBatch() when done to trigger a single recalculation
|
|
3949
|
+
*/
|
|
3950
|
+
startBatch() {
|
|
3951
|
+
this.batchingUpdates = true;
|
|
3952
|
+
this.pendingRecalculation = false;
|
|
3953
|
+
}
|
|
3954
|
+
/**
|
|
3955
|
+
* End batching and trigger layout recalculation if needed
|
|
3956
|
+
*/
|
|
3957
|
+
endBatch() {
|
|
3958
|
+
this.batchingUpdates = false;
|
|
3959
|
+
if (this.pendingRecalculation) {
|
|
3960
|
+
this.pendingRecalculation = false;
|
|
3961
|
+
this.recalculateLayout();
|
|
3962
|
+
this.emit("layout-changed");
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
/**
|
|
3966
|
+
* Recalculate layout for all registered controls
|
|
3967
|
+
*/
|
|
3968
|
+
recalculateLayout() {
|
|
3969
|
+
if (this.batchingUpdates) {
|
|
3970
|
+
this.pendingRecalculation = true;
|
|
3971
|
+
return;
|
|
3972
|
+
}
|
|
3973
|
+
this.offsets.clear();
|
|
3974
|
+
if (this.mapDimensions.width === 0 || this.mapDimensions.height === 0) {
|
|
3975
|
+
return;
|
|
3976
|
+
}
|
|
3977
|
+
const controlsByPosition = this.groupControlsByPosition();
|
|
3978
|
+
const positionedBoxes = /* @__PURE__ */ new Map();
|
|
3979
|
+
for (const [position, controls] of controlsByPosition) {
|
|
3980
|
+
this.calculatePositionStack(position, controls, positionedBoxes);
|
|
3981
|
+
}
|
|
3982
|
+
this.resolveCollisions(positionedBoxes);
|
|
3983
|
+
}
|
|
3984
|
+
/**
|
|
3985
|
+
* Group controls by their primary position
|
|
3986
|
+
*/
|
|
3987
|
+
groupControlsByPosition() {
|
|
3988
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
3989
|
+
for (const control of this.controls.values()) {
|
|
3990
|
+
const position = control.position.primary;
|
|
3991
|
+
const existing = grouped.get(position) || [];
|
|
3992
|
+
existing.push(control);
|
|
3993
|
+
grouped.set(position, existing);
|
|
3994
|
+
}
|
|
3995
|
+
for (const [position, controls] of grouped) {
|
|
3996
|
+
controls.sort((a, b) => {
|
|
3997
|
+
const aPriority = PRIORITY_ORDER.indexOf(a.priority);
|
|
3998
|
+
const bPriority = PRIORITY_ORDER.indexOf(b.priority);
|
|
3999
|
+
return bPriority - aPriority;
|
|
4000
|
+
});
|
|
4001
|
+
grouped.set(position, controls);
|
|
4002
|
+
}
|
|
4003
|
+
return grouped;
|
|
4004
|
+
}
|
|
4005
|
+
/**
|
|
4006
|
+
* Calculate stacked offsets for controls at a single position
|
|
4007
|
+
*/
|
|
4008
|
+
calculatePositionStack(position, controls, positionedBoxes) {
|
|
4009
|
+
let stackOffset = 0;
|
|
4010
|
+
const isBottomPosition = position.startsWith("bottom");
|
|
4011
|
+
const isTopPosition = position.startsWith("top");
|
|
4012
|
+
const isCenterHorizontal = position.includes("center");
|
|
4013
|
+
const isRightPosition = position.includes("right");
|
|
4014
|
+
for (const control of controls) {
|
|
4015
|
+
const dimensions = control.isExpanded && control.expandedDimensions ? control.expandedDimensions : control.dimensions;
|
|
4016
|
+
let x = EDGE_MARGIN;
|
|
4017
|
+
let y = EDGE_MARGIN + stackOffset;
|
|
4018
|
+
if (isCenterHorizontal) {
|
|
4019
|
+
x = (this.mapDimensions.width - dimensions.width) / 2;
|
|
4020
|
+
} else if (isRightPosition) {
|
|
4021
|
+
x = EDGE_MARGIN;
|
|
4022
|
+
}
|
|
4023
|
+
if (isBottomPosition) {
|
|
4024
|
+
const attributionOffset = position === "bottom-right" ? ATTRIBUTION_HEIGHT : 0;
|
|
4025
|
+
y = EDGE_MARGIN + attributionOffset + stackOffset;
|
|
4026
|
+
} else if (position.startsWith("middle")) {
|
|
4027
|
+
y = (this.mapDimensions.height - dimensions.height) / 2;
|
|
4028
|
+
}
|
|
4029
|
+
let absoluteX = x;
|
|
4030
|
+
let absoluteY = y;
|
|
4031
|
+
if (isRightPosition && !isCenterHorizontal) {
|
|
4032
|
+
absoluteX = this.mapDimensions.width - dimensions.width - x;
|
|
4033
|
+
}
|
|
4034
|
+
if (isBottomPosition) {
|
|
4035
|
+
absoluteY = this.mapDimensions.height - dimensions.height - y;
|
|
4036
|
+
}
|
|
4037
|
+
const boundingBox = {
|
|
4038
|
+
left: absoluteX,
|
|
4039
|
+
top: absoluteY,
|
|
4040
|
+
right: absoluteX + dimensions.width,
|
|
4041
|
+
bottom: absoluteY + dimensions.height
|
|
4042
|
+
};
|
|
4043
|
+
const visible = this.isBoxInViewport(boundingBox);
|
|
4044
|
+
const zIndex = this.calculateZIndex(control);
|
|
4045
|
+
this.offsets.set(control.id, {
|
|
4046
|
+
x,
|
|
4047
|
+
y,
|
|
4048
|
+
zIndex,
|
|
4049
|
+
position,
|
|
4050
|
+
visible,
|
|
4051
|
+
usedFallback: false,
|
|
4052
|
+
warning: visible ? void 0 : "Control may be outside visible area"
|
|
4053
|
+
});
|
|
4054
|
+
positionedBoxes.set(control.id, boundingBox);
|
|
4055
|
+
if (isBottomPosition || isTopPosition) {
|
|
4056
|
+
stackOffset += dimensions.height + STACK_GAP;
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
/**
|
|
4061
|
+
* Calculate z-index for a control based on its layer and state
|
|
4062
|
+
*/
|
|
4063
|
+
calculateZIndex(control) {
|
|
4064
|
+
let baseZ = Z_INDEX_LAYERS[control.zLayer];
|
|
4065
|
+
if (control.isExpanded) {
|
|
4066
|
+
baseZ += 5;
|
|
4067
|
+
}
|
|
4068
|
+
const priorityBonus = PRIORITY_ORDER.indexOf(control.priority);
|
|
4069
|
+
baseZ += priorityBonus;
|
|
4070
|
+
return baseZ;
|
|
4071
|
+
}
|
|
4072
|
+
/**
|
|
4073
|
+
* Check if a bounding box is within the viewport
|
|
4074
|
+
*/
|
|
4075
|
+
isBoxInViewport(box) {
|
|
4076
|
+
return box.left >= 0 && box.top >= 0 && box.right <= this.mapDimensions.width && box.bottom <= this.mapDimensions.height;
|
|
4077
|
+
}
|
|
4078
|
+
/**
|
|
4079
|
+
* Detect collisions between bounding boxes
|
|
4080
|
+
*/
|
|
4081
|
+
boxesCollide(box1, box2) {
|
|
4082
|
+
return !(box1.right < box2.left || box1.left > box2.right || box1.bottom < box2.top || box1.top > box2.bottom);
|
|
4083
|
+
}
|
|
4084
|
+
/**
|
|
4085
|
+
* Resolve collisions by moving lower-priority controls to fallback positions
|
|
4086
|
+
*/
|
|
4087
|
+
resolveCollisions(positionedBoxes) {
|
|
4088
|
+
const sortedControls = Array.from(this.controls.values()).sort((a, b) => {
|
|
4089
|
+
const aPriority = PRIORITY_ORDER.indexOf(a.priority);
|
|
4090
|
+
const bPriority = PRIORITY_ORDER.indexOf(b.priority);
|
|
4091
|
+
return aPriority - bPriority;
|
|
4092
|
+
});
|
|
4093
|
+
for (const control of sortedControls) {
|
|
4094
|
+
const currentBox = positionedBoxes.get(control.id);
|
|
4095
|
+
if (!currentBox) continue;
|
|
4096
|
+
let hasCollision = false;
|
|
4097
|
+
for (const [otherId, otherBox] of positionedBoxes) {
|
|
4098
|
+
if (otherId === control.id) continue;
|
|
4099
|
+
const otherControl = this.controls.get(otherId);
|
|
4100
|
+
if (!otherControl) continue;
|
|
4101
|
+
const otherPriority = PRIORITY_ORDER.indexOf(otherControl.priority);
|
|
4102
|
+
const thisPriority = PRIORITY_ORDER.indexOf(control.priority);
|
|
4103
|
+
if (otherPriority > thisPriority && this.boxesCollide(currentBox, otherBox)) {
|
|
4104
|
+
hasCollision = true;
|
|
4105
|
+
break;
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
if (hasCollision && control.position.fallbacks?.length) {
|
|
4109
|
+
const newPosition = this.tryFallbackPositions(control, positionedBoxes);
|
|
4110
|
+
if (newPosition) {
|
|
4111
|
+
const offset = this.offsets.get(control.id);
|
|
4112
|
+
if (offset) {
|
|
4113
|
+
offset.usedFallback = true;
|
|
4114
|
+
offset.position = newPosition;
|
|
4115
|
+
}
|
|
4116
|
+
}
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
/**
|
|
4121
|
+
* Try fallback positions for a control
|
|
4122
|
+
*
|
|
4123
|
+
* @returns The fallback position that worked, or null if none worked
|
|
4124
|
+
*/
|
|
4125
|
+
tryFallbackPositions(control, positionedBoxes) {
|
|
4126
|
+
const fallbacks = control.position.fallbacks || [];
|
|
4127
|
+
for (const fallbackPosition of fallbacks) {
|
|
4128
|
+
const dimensions = control.isExpanded && control.expandedDimensions ? control.expandedDimensions : control.dimensions;
|
|
4129
|
+
const newBox = this.calculateBoxAtPosition(fallbackPosition, dimensions);
|
|
4130
|
+
let isValid = true;
|
|
4131
|
+
for (const [otherId, otherBox] of positionedBoxes) {
|
|
4132
|
+
if (otherId === control.id) continue;
|
|
4133
|
+
const otherControl = this.controls.get(otherId);
|
|
4134
|
+
if (!otherControl) continue;
|
|
4135
|
+
if (this.boxesCollide(newBox, otherBox)) {
|
|
4136
|
+
isValid = false;
|
|
4137
|
+
break;
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
if (isValid && this.isBoxInViewport(newBox)) {
|
|
4141
|
+
positionedBoxes.set(control.id, newBox);
|
|
4142
|
+
let cssX = EDGE_MARGIN;
|
|
4143
|
+
let cssY = EDGE_MARGIN;
|
|
4144
|
+
if (fallbackPosition.includes("center")) {
|
|
4145
|
+
cssX = (this.mapDimensions.width - dimensions.width) / 2;
|
|
4146
|
+
}
|
|
4147
|
+
if (fallbackPosition.startsWith("middle")) {
|
|
4148
|
+
cssY = (this.mapDimensions.height - dimensions.height) / 2;
|
|
4149
|
+
} else if (fallbackPosition === "bottom-right") {
|
|
4150
|
+
cssY = EDGE_MARGIN + ATTRIBUTION_HEIGHT;
|
|
4151
|
+
}
|
|
4152
|
+
const offset = this.offsets.get(control.id);
|
|
4153
|
+
if (offset) {
|
|
4154
|
+
offset.x = cssX;
|
|
4155
|
+
offset.y = cssY;
|
|
4156
|
+
offset.position = fallbackPosition;
|
|
4157
|
+
offset.visible = true;
|
|
4158
|
+
}
|
|
4159
|
+
return fallbackPosition;
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
return null;
|
|
4163
|
+
}
|
|
4164
|
+
/**
|
|
4165
|
+
* Calculate absolute bounding box for a control at a specific position
|
|
4166
|
+
* Returns absolute coordinates for collision detection
|
|
4167
|
+
*/
|
|
4168
|
+
calculateBoxAtPosition(position, dimensions) {
|
|
4169
|
+
const isCenterHorizontal = position.includes("center");
|
|
4170
|
+
const isRightPosition = position.includes("right");
|
|
4171
|
+
const isBottomPosition = position.startsWith("bottom");
|
|
4172
|
+
const isMiddleVertical = position.startsWith("middle");
|
|
4173
|
+
let x = EDGE_MARGIN;
|
|
4174
|
+
if (isCenterHorizontal) {
|
|
4175
|
+
x = (this.mapDimensions.width - dimensions.width) / 2;
|
|
4176
|
+
} else if (isRightPosition) {
|
|
4177
|
+
x = this.mapDimensions.width - dimensions.width - EDGE_MARGIN;
|
|
4178
|
+
}
|
|
4179
|
+
const attributionOffset = position === "bottom-right" ? ATTRIBUTION_HEIGHT : 0;
|
|
4180
|
+
let y = EDGE_MARGIN;
|
|
4181
|
+
if (isBottomPosition) {
|
|
4182
|
+
y = this.mapDimensions.height - dimensions.height - EDGE_MARGIN - attributionOffset;
|
|
4183
|
+
} else if (isMiddleVertical) {
|
|
4184
|
+
y = (this.mapDimensions.height - dimensions.height) / 2;
|
|
4185
|
+
}
|
|
4186
|
+
return {
|
|
4187
|
+
left: x,
|
|
4188
|
+
top: y,
|
|
4189
|
+
right: x + dimensions.width,
|
|
4190
|
+
bottom: y + dimensions.height
|
|
4191
|
+
};
|
|
4192
|
+
}
|
|
4193
|
+
/**
|
|
4194
|
+
* Emit an event to all listeners
|
|
4195
|
+
*/
|
|
4196
|
+
emit(type, controlId) {
|
|
4197
|
+
const event = {
|
|
4198
|
+
type,
|
|
4199
|
+
controlId,
|
|
4200
|
+
offsets: this.getAllOffsets(),
|
|
4201
|
+
timestamp: Date.now()
|
|
4202
|
+
};
|
|
4203
|
+
for (const listener of this.listeners) {
|
|
4204
|
+
try {
|
|
4205
|
+
listener(event);
|
|
4206
|
+
} catch (error) {
|
|
4207
|
+
console.error("PositioningCoordinator: Error in event listener", error);
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
}
|
|
4211
|
+
/**
|
|
4212
|
+
* Clear all registrations and reset state
|
|
4213
|
+
*/
|
|
4214
|
+
destroy() {
|
|
4215
|
+
this.controls.clear();
|
|
4216
|
+
this.offsets.clear();
|
|
4217
|
+
this.listeners.clear();
|
|
4218
|
+
this.mapDimensions = { width: 0, height: 0 };
|
|
4219
|
+
}
|
|
4220
|
+
};
|
|
4221
|
+
function createPositioningCoordinator() {
|
|
4222
|
+
return new PositioningCoordinator();
|
|
4223
|
+
}
|
|
4224
|
+
|
|
3858
4225
|
// src/colors/realEstate.ts
|
|
3859
4226
|
var lotAvailabilityColors = {
|
|
3860
4227
|
Available: "#4caf50",
|
|
@@ -3969,7 +4336,6 @@ function createMatchedColorExpression(baseColorExpression, matchedProperty = "ma
|
|
|
3969
4336
|
];
|
|
3970
4337
|
}
|
|
3971
4338
|
|
|
3972
|
-
exports.BASE_OFFSET = BASE_OFFSET;
|
|
3973
4339
|
exports.BIKE_LANES = BIKE_LANES;
|
|
3974
4340
|
exports.BUILTIN_BASEMAPS = BUILTIN_BASEMAPS;
|
|
3975
4341
|
exports.BUILTIN_OVERLAY_LAYERS = BUILTIN_OVERLAY_LAYERS;
|
|
@@ -3978,6 +4344,7 @@ exports.CITY_LIMITS = CITY_LIMITS;
|
|
|
3978
4344
|
exports.CLASSIC_DARK = CLASSIC_DARK;
|
|
3979
4345
|
exports.CLASSIC_LIGHT = CLASSIC_LIGHT;
|
|
3980
4346
|
exports.DEFAULT_SIMPLIFICATION_THRESHOLDS = DEFAULT_SIMPLIFICATION_THRESHOLDS;
|
|
4347
|
+
exports.EDGE_MARGIN = EDGE_MARGIN;
|
|
3981
4348
|
exports.FLOOD_ZONES = FLOOD_ZONES;
|
|
3982
4349
|
exports.FREE_BASEMAPS = FREE_BASEMAPS;
|
|
3983
4350
|
exports.KEYBOARD_CONTROLS = KEYBOARD_CONTROLS;
|
|
@@ -3986,12 +4353,13 @@ exports.MAPTILER_OUTDOOR = MAPTILER_OUTDOOR;
|
|
|
3986
4353
|
exports.MAPTILER_SATELLITE = MAPTILER_SATELLITE;
|
|
3987
4354
|
exports.MAPTILER_STREETS = MAPTILER_STREETS;
|
|
3988
4355
|
exports.MARKER_PROTECTION_CLASS = MARKER_PROTECTION_CLASS;
|
|
3989
|
-
exports.OFFSET_CLASSES = OFFSET_CLASSES;
|
|
3990
4356
|
exports.OSM_STANDARD = OSM_STANDARD;
|
|
3991
4357
|
exports.PARKS = PARKS;
|
|
3992
|
-
exports.
|
|
4358
|
+
exports.PRIORITY_ORDER = PRIORITY_ORDER;
|
|
4359
|
+
exports.PositioningCoordinator = PositioningCoordinator;
|
|
3993
4360
|
exports.SCHOOL_DISTRICTS = SCHOOL_DISTRICTS;
|
|
3994
4361
|
exports.SPORTS_FACILITIES = SPORTS_FACILITIES;
|
|
4362
|
+
exports.STACK_GAP = STACK_GAP;
|
|
3995
4363
|
exports.STADIA_ALIDADE_DARK = STADIA_ALIDADE_DARK;
|
|
3996
4364
|
exports.STADIA_ALIDADE_SMOOTH = STADIA_ALIDADE_SMOOTH;
|
|
3997
4365
|
exports.STADIA_STAMEN_TERRAIN = STADIA_STAMEN_TERRAIN;
|
|
@@ -4003,6 +4371,7 @@ exports.TRAILS = TRAILS;
|
|
|
4003
4371
|
exports.TRANSIT_ROUTES = TRANSIT_ROUTES;
|
|
4004
4372
|
exports.WATERSHEDS = WATERSHEDS;
|
|
4005
4373
|
exports.ZONING_DISTRICTS = ZONING_DISTRICTS;
|
|
4374
|
+
exports.Z_INDEX_LAYERS = Z_INDEX_LAYERS;
|
|
4006
4375
|
exports.applyMarkerChildProtection = applyMarkerChildProtection;
|
|
4007
4376
|
exports.applyMarkerProtection = applyMarkerProtection;
|
|
4008
4377
|
exports.boundaryColors = boundaryColors;
|
|
@@ -4015,8 +4384,6 @@ exports.calculateZoomThresholds = calculateZoomThresholds;
|
|
|
4015
4384
|
exports.clusterColorExpression = clusterColorExpression;
|
|
4016
4385
|
exports.clusterColors = clusterColors;
|
|
4017
4386
|
exports.combineBounds = combineBounds;
|
|
4018
|
-
exports.computePositionClasses = computePositionClasses;
|
|
4019
|
-
exports.computeVerticalOffsetStyle = computeVerticalOffsetStyle;
|
|
4020
4387
|
exports.countFeaturesByType = countFeaturesByType;
|
|
4021
4388
|
exports.createCategoricalColorExpression = createCategoricalColorExpression;
|
|
4022
4389
|
exports.createCircleStyle = createCircleStyle;
|
|
@@ -4036,6 +4403,7 @@ exports.createLineStyle = createLineStyle;
|
|
|
4036
4403
|
exports.createLotFillStyle = createLotFillStyle;
|
|
4037
4404
|
exports.createLotOutlineStyle = createLotOutlineStyle;
|
|
4038
4405
|
exports.createMatchedColorExpression = createMatchedColorExpression;
|
|
4406
|
+
exports.createPositioningCoordinator = createPositioningCoordinator;
|
|
4039
4407
|
exports.createPredictiveViewportManager = createPredictiveViewportManager;
|
|
4040
4408
|
exports.createRTreeViewportManager = createRTreeViewportManager;
|
|
4041
4409
|
exports.createSelectionExpression = createSelectionExpression;
|