@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.js
CHANGED
|
@@ -934,49 +934,6 @@ function filterByGeometryType(geojson, types) {
|
|
|
934
934
|
};
|
|
935
935
|
}
|
|
936
936
|
|
|
937
|
-
// src/utils/positioning.ts
|
|
938
|
-
var BASE_OFFSET = 8;
|
|
939
|
-
var POSITION_CLASSES = {
|
|
940
|
-
"top-left": "top-2 left-2",
|
|
941
|
-
"top-right": "top-2 right-2",
|
|
942
|
-
"bottom-left": "bottom-2 left-2",
|
|
943
|
-
"bottom-right": "bottom-2 right-2"
|
|
944
|
-
};
|
|
945
|
-
var OFFSET_CLASSES = {
|
|
946
|
-
"top-left": "left-14",
|
|
947
|
-
// Offset right (toward center)
|
|
948
|
-
"top-right": "right-14",
|
|
949
|
-
// Offset left (toward center)
|
|
950
|
-
"bottom-left": "left-14",
|
|
951
|
-
// Offset right (toward center)
|
|
952
|
-
"bottom-right": "right-14"
|
|
953
|
-
// Offset left (toward center)
|
|
954
|
-
};
|
|
955
|
-
function computePositionClasses(position, hasControlsAtPosition) {
|
|
956
|
-
const base = POSITION_CLASSES[position];
|
|
957
|
-
if (!hasControlsAtPosition) {
|
|
958
|
-
return base;
|
|
959
|
-
}
|
|
960
|
-
const offset = OFFSET_CLASSES[position];
|
|
961
|
-
if (position.includes("left")) {
|
|
962
|
-
return base.replace("left-2", offset);
|
|
963
|
-
}
|
|
964
|
-
if (position.includes("right")) {
|
|
965
|
-
return base.replace("right-2", offset);
|
|
966
|
-
}
|
|
967
|
-
return base;
|
|
968
|
-
}
|
|
969
|
-
function computeVerticalOffsetStyle(position, customControlOffset, baseOffset = BASE_OFFSET) {
|
|
970
|
-
if (customControlOffset <= 0) {
|
|
971
|
-
return {};
|
|
972
|
-
}
|
|
973
|
-
const totalOffset = `${baseOffset + customControlOffset}px`;
|
|
974
|
-
if (position.includes("top")) {
|
|
975
|
-
return { top: totalOffset };
|
|
976
|
-
}
|
|
977
|
-
return { bottom: totalOffset };
|
|
978
|
-
}
|
|
979
|
-
|
|
980
937
|
// src/utils/cluster.ts
|
|
981
938
|
function isClusterFeature(feature) {
|
|
982
939
|
return feature.properties !== null && feature.properties !== void 0 && typeof feature.properties === "object" && "cluster_id" in feature.properties && "point_count" in feature.properties;
|
|
@@ -3320,6 +3277,416 @@ function getLayersWithErrors(states) {
|
|
|
3320
3277
|
return Array.from(states.values()).filter((state) => state.error !== null);
|
|
3321
3278
|
}
|
|
3322
3279
|
|
|
3280
|
+
// src/positioning/types.ts
|
|
3281
|
+
var Z_INDEX_LAYERS = {
|
|
3282
|
+
base: 10,
|
|
3283
|
+
interactive: 20,
|
|
3284
|
+
expanded: 30,
|
|
3285
|
+
modal: 40,
|
|
3286
|
+
tooltip: 50
|
|
3287
|
+
};
|
|
3288
|
+
var PRIORITY_ORDER = ["low", "normal", "high", "critical"];
|
|
3289
|
+
var STACK_GAP = 8;
|
|
3290
|
+
var EDGE_MARGIN = 8;
|
|
3291
|
+
var ATTRIBUTION_HEIGHT = 32;
|
|
3292
|
+
|
|
3293
|
+
// src/positioning/PositioningCoordinator.ts
|
|
3294
|
+
var PositioningCoordinator = class {
|
|
3295
|
+
constructor() {
|
|
3296
|
+
/** Registered controls */
|
|
3297
|
+
this.controls = /* @__PURE__ */ new Map();
|
|
3298
|
+
/** Computed offsets for each control */
|
|
3299
|
+
this.offsets = /* @__PURE__ */ new Map();
|
|
3300
|
+
/** Current map dimensions */
|
|
3301
|
+
this.mapDimensions = { width: 0, height: 0 };
|
|
3302
|
+
/** Event listeners */
|
|
3303
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
3304
|
+
/** Batch update flag to defer layout recalculation */
|
|
3305
|
+
this.batchingUpdates = false;
|
|
3306
|
+
/** Pending recalculation flag during batching */
|
|
3307
|
+
this.pendingRecalculation = false;
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* Register a control with the coordinator
|
|
3311
|
+
*
|
|
3312
|
+
* @param registration - Control registration data
|
|
3313
|
+
* @returns Computed offset for the control, or null if registration failed
|
|
3314
|
+
*/
|
|
3315
|
+
register(registration) {
|
|
3316
|
+
if (this.controls.has(registration.id)) {
|
|
3317
|
+
console.warn(
|
|
3318
|
+
`PositioningCoordinator: Control "${registration.id}" is already registered. Use update() to modify.`
|
|
3319
|
+
);
|
|
3320
|
+
return this.offsets.get(registration.id) || null;
|
|
3321
|
+
}
|
|
3322
|
+
this.controls.set(registration.id, { ...registration });
|
|
3323
|
+
this.recalculateLayout();
|
|
3324
|
+
this.emit("control-registered", registration.id);
|
|
3325
|
+
return this.offsets.get(registration.id) || null;
|
|
3326
|
+
}
|
|
3327
|
+
/**
|
|
3328
|
+
* Unregister a control from the coordinator
|
|
3329
|
+
*
|
|
3330
|
+
* @param controlId - ID of the control to unregister
|
|
3331
|
+
*/
|
|
3332
|
+
unregister(controlId) {
|
|
3333
|
+
if (!this.controls.has(controlId)) {
|
|
3334
|
+
return;
|
|
3335
|
+
}
|
|
3336
|
+
this.controls.delete(controlId);
|
|
3337
|
+
this.offsets.delete(controlId);
|
|
3338
|
+
this.recalculateLayout();
|
|
3339
|
+
this.emit("control-unregistered", controlId);
|
|
3340
|
+
}
|
|
3341
|
+
/**
|
|
3342
|
+
* Update a control's registration
|
|
3343
|
+
*
|
|
3344
|
+
* @param controlId - ID of the control to update
|
|
3345
|
+
* @param updates - Partial registration updates
|
|
3346
|
+
* @returns Updated offset, or null if control not found
|
|
3347
|
+
*/
|
|
3348
|
+
update(controlId, updates) {
|
|
3349
|
+
const existing = this.controls.get(controlId);
|
|
3350
|
+
if (!existing) {
|
|
3351
|
+
console.warn(`PositioningCoordinator: Cannot update unregistered control "${controlId}"`);
|
|
3352
|
+
return null;
|
|
3353
|
+
}
|
|
3354
|
+
this.controls.set(controlId, { ...existing, ...updates });
|
|
3355
|
+
this.recalculateLayout();
|
|
3356
|
+
this.emit("control-updated", controlId);
|
|
3357
|
+
return this.offsets.get(controlId) || null;
|
|
3358
|
+
}
|
|
3359
|
+
/**
|
|
3360
|
+
* Set the expanded state of a control
|
|
3361
|
+
*
|
|
3362
|
+
* @param controlId - ID of the control
|
|
3363
|
+
* @param isExpanded - Whether the control is expanded
|
|
3364
|
+
* @returns Updated offset, or null if control not found
|
|
3365
|
+
*/
|
|
3366
|
+
setExpanded(controlId, isExpanded) {
|
|
3367
|
+
return this.update(controlId, { isExpanded });
|
|
3368
|
+
}
|
|
3369
|
+
/**
|
|
3370
|
+
* Set the map dimensions for layout calculations
|
|
3371
|
+
*
|
|
3372
|
+
* @param dimensions - New map dimensions
|
|
3373
|
+
*/
|
|
3374
|
+
setMapDimensions(dimensions) {
|
|
3375
|
+
if (dimensions.width === this.mapDimensions.width && dimensions.height === this.mapDimensions.height) {
|
|
3376
|
+
return;
|
|
3377
|
+
}
|
|
3378
|
+
this.mapDimensions = { ...dimensions };
|
|
3379
|
+
this.recalculateLayout();
|
|
3380
|
+
this.emit("map-resized");
|
|
3381
|
+
}
|
|
3382
|
+
/**
|
|
3383
|
+
* Get the current offset for a control
|
|
3384
|
+
*
|
|
3385
|
+
* @param controlId - ID of the control
|
|
3386
|
+
* @returns Current offset, or null if not found
|
|
3387
|
+
*/
|
|
3388
|
+
getOffset(controlId) {
|
|
3389
|
+
return this.offsets.get(controlId) || null;
|
|
3390
|
+
}
|
|
3391
|
+
/**
|
|
3392
|
+
* Get all current offsets
|
|
3393
|
+
*
|
|
3394
|
+
* @returns Map of control IDs to offsets
|
|
3395
|
+
*/
|
|
3396
|
+
getAllOffsets() {
|
|
3397
|
+
return new Map(this.offsets);
|
|
3398
|
+
}
|
|
3399
|
+
/**
|
|
3400
|
+
* Subscribe to coordinator events
|
|
3401
|
+
*
|
|
3402
|
+
* @param listener - Event listener function
|
|
3403
|
+
* @returns Unsubscribe function
|
|
3404
|
+
*/
|
|
3405
|
+
subscribe(listener) {
|
|
3406
|
+
this.listeners.add(listener);
|
|
3407
|
+
return () => {
|
|
3408
|
+
this.listeners.delete(listener);
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
/**
|
|
3412
|
+
* Start batching updates to defer layout recalculation
|
|
3413
|
+
* Call endBatch() when done to trigger a single recalculation
|
|
3414
|
+
*/
|
|
3415
|
+
startBatch() {
|
|
3416
|
+
this.batchingUpdates = true;
|
|
3417
|
+
this.pendingRecalculation = false;
|
|
3418
|
+
}
|
|
3419
|
+
/**
|
|
3420
|
+
* End batching and trigger layout recalculation if needed
|
|
3421
|
+
*/
|
|
3422
|
+
endBatch() {
|
|
3423
|
+
this.batchingUpdates = false;
|
|
3424
|
+
if (this.pendingRecalculation) {
|
|
3425
|
+
this.pendingRecalculation = false;
|
|
3426
|
+
this.recalculateLayout();
|
|
3427
|
+
this.emit("layout-changed");
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
/**
|
|
3431
|
+
* Recalculate layout for all registered controls
|
|
3432
|
+
*/
|
|
3433
|
+
recalculateLayout() {
|
|
3434
|
+
if (this.batchingUpdates) {
|
|
3435
|
+
this.pendingRecalculation = true;
|
|
3436
|
+
return;
|
|
3437
|
+
}
|
|
3438
|
+
this.offsets.clear();
|
|
3439
|
+
if (this.mapDimensions.width === 0 || this.mapDimensions.height === 0) {
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
const controlsByPosition = this.groupControlsByPosition();
|
|
3443
|
+
const positionedBoxes = /* @__PURE__ */ new Map();
|
|
3444
|
+
for (const [position, controls] of controlsByPosition) {
|
|
3445
|
+
this.calculatePositionStack(position, controls, positionedBoxes);
|
|
3446
|
+
}
|
|
3447
|
+
this.resolveCollisions(positionedBoxes);
|
|
3448
|
+
}
|
|
3449
|
+
/**
|
|
3450
|
+
* Group controls by their primary position
|
|
3451
|
+
*/
|
|
3452
|
+
groupControlsByPosition() {
|
|
3453
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
3454
|
+
for (const control of this.controls.values()) {
|
|
3455
|
+
const position = control.position.primary;
|
|
3456
|
+
const existing = grouped.get(position) || [];
|
|
3457
|
+
existing.push(control);
|
|
3458
|
+
grouped.set(position, existing);
|
|
3459
|
+
}
|
|
3460
|
+
for (const [position, controls] of grouped) {
|
|
3461
|
+
controls.sort((a, b) => {
|
|
3462
|
+
const aPriority = PRIORITY_ORDER.indexOf(a.priority);
|
|
3463
|
+
const bPriority = PRIORITY_ORDER.indexOf(b.priority);
|
|
3464
|
+
return bPriority - aPriority;
|
|
3465
|
+
});
|
|
3466
|
+
grouped.set(position, controls);
|
|
3467
|
+
}
|
|
3468
|
+
return grouped;
|
|
3469
|
+
}
|
|
3470
|
+
/**
|
|
3471
|
+
* Calculate stacked offsets for controls at a single position
|
|
3472
|
+
*/
|
|
3473
|
+
calculatePositionStack(position, controls, positionedBoxes) {
|
|
3474
|
+
let stackOffset = 0;
|
|
3475
|
+
const isBottomPosition = position.startsWith("bottom");
|
|
3476
|
+
const isTopPosition = position.startsWith("top");
|
|
3477
|
+
const isCenterHorizontal = position.includes("center");
|
|
3478
|
+
const isRightPosition = position.includes("right");
|
|
3479
|
+
for (const control of controls) {
|
|
3480
|
+
const dimensions = control.isExpanded && control.expandedDimensions ? control.expandedDimensions : control.dimensions;
|
|
3481
|
+
let x = EDGE_MARGIN;
|
|
3482
|
+
let y = EDGE_MARGIN + stackOffset;
|
|
3483
|
+
if (isCenterHorizontal) {
|
|
3484
|
+
x = (this.mapDimensions.width - dimensions.width) / 2;
|
|
3485
|
+
} else if (isRightPosition) {
|
|
3486
|
+
x = EDGE_MARGIN;
|
|
3487
|
+
}
|
|
3488
|
+
if (isBottomPosition) {
|
|
3489
|
+
const attributionOffset = position === "bottom-right" ? ATTRIBUTION_HEIGHT : 0;
|
|
3490
|
+
y = EDGE_MARGIN + attributionOffset + stackOffset;
|
|
3491
|
+
} else if (position.startsWith("middle")) {
|
|
3492
|
+
y = (this.mapDimensions.height - dimensions.height) / 2;
|
|
3493
|
+
}
|
|
3494
|
+
let absoluteX = x;
|
|
3495
|
+
let absoluteY = y;
|
|
3496
|
+
if (isRightPosition && !isCenterHorizontal) {
|
|
3497
|
+
absoluteX = this.mapDimensions.width - dimensions.width - x;
|
|
3498
|
+
}
|
|
3499
|
+
if (isBottomPosition) {
|
|
3500
|
+
absoluteY = this.mapDimensions.height - dimensions.height - y;
|
|
3501
|
+
}
|
|
3502
|
+
const boundingBox = {
|
|
3503
|
+
left: absoluteX,
|
|
3504
|
+
top: absoluteY,
|
|
3505
|
+
right: absoluteX + dimensions.width,
|
|
3506
|
+
bottom: absoluteY + dimensions.height
|
|
3507
|
+
};
|
|
3508
|
+
const visible = this.isBoxInViewport(boundingBox);
|
|
3509
|
+
const zIndex = this.calculateZIndex(control);
|
|
3510
|
+
this.offsets.set(control.id, {
|
|
3511
|
+
x,
|
|
3512
|
+
y,
|
|
3513
|
+
zIndex,
|
|
3514
|
+
position,
|
|
3515
|
+
visible,
|
|
3516
|
+
usedFallback: false,
|
|
3517
|
+
warning: visible ? void 0 : "Control may be outside visible area"
|
|
3518
|
+
});
|
|
3519
|
+
positionedBoxes.set(control.id, boundingBox);
|
|
3520
|
+
if (isBottomPosition || isTopPosition) {
|
|
3521
|
+
stackOffset += dimensions.height + STACK_GAP;
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
/**
|
|
3526
|
+
* Calculate z-index for a control based on its layer and state
|
|
3527
|
+
*/
|
|
3528
|
+
calculateZIndex(control) {
|
|
3529
|
+
let baseZ = Z_INDEX_LAYERS[control.zLayer];
|
|
3530
|
+
if (control.isExpanded) {
|
|
3531
|
+
baseZ += 5;
|
|
3532
|
+
}
|
|
3533
|
+
const priorityBonus = PRIORITY_ORDER.indexOf(control.priority);
|
|
3534
|
+
baseZ += priorityBonus;
|
|
3535
|
+
return baseZ;
|
|
3536
|
+
}
|
|
3537
|
+
/**
|
|
3538
|
+
* Check if a bounding box is within the viewport
|
|
3539
|
+
*/
|
|
3540
|
+
isBoxInViewport(box) {
|
|
3541
|
+
return box.left >= 0 && box.top >= 0 && box.right <= this.mapDimensions.width && box.bottom <= this.mapDimensions.height;
|
|
3542
|
+
}
|
|
3543
|
+
/**
|
|
3544
|
+
* Detect collisions between bounding boxes
|
|
3545
|
+
*/
|
|
3546
|
+
boxesCollide(box1, box2) {
|
|
3547
|
+
return !(box1.right < box2.left || box1.left > box2.right || box1.bottom < box2.top || box1.top > box2.bottom);
|
|
3548
|
+
}
|
|
3549
|
+
/**
|
|
3550
|
+
* Resolve collisions by moving lower-priority controls to fallback positions
|
|
3551
|
+
*/
|
|
3552
|
+
resolveCollisions(positionedBoxes) {
|
|
3553
|
+
const sortedControls = Array.from(this.controls.values()).sort((a, b) => {
|
|
3554
|
+
const aPriority = PRIORITY_ORDER.indexOf(a.priority);
|
|
3555
|
+
const bPriority = PRIORITY_ORDER.indexOf(b.priority);
|
|
3556
|
+
return aPriority - bPriority;
|
|
3557
|
+
});
|
|
3558
|
+
for (const control of sortedControls) {
|
|
3559
|
+
const currentBox = positionedBoxes.get(control.id);
|
|
3560
|
+
if (!currentBox) continue;
|
|
3561
|
+
let hasCollision = false;
|
|
3562
|
+
for (const [otherId, otherBox] of positionedBoxes) {
|
|
3563
|
+
if (otherId === control.id) continue;
|
|
3564
|
+
const otherControl = this.controls.get(otherId);
|
|
3565
|
+
if (!otherControl) continue;
|
|
3566
|
+
const otherPriority = PRIORITY_ORDER.indexOf(otherControl.priority);
|
|
3567
|
+
const thisPriority = PRIORITY_ORDER.indexOf(control.priority);
|
|
3568
|
+
if (otherPriority > thisPriority && this.boxesCollide(currentBox, otherBox)) {
|
|
3569
|
+
hasCollision = true;
|
|
3570
|
+
break;
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
if (hasCollision && control.position.fallbacks?.length) {
|
|
3574
|
+
const newPosition = this.tryFallbackPositions(control, positionedBoxes);
|
|
3575
|
+
if (newPosition) {
|
|
3576
|
+
const offset = this.offsets.get(control.id);
|
|
3577
|
+
if (offset) {
|
|
3578
|
+
offset.usedFallback = true;
|
|
3579
|
+
offset.position = newPosition;
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
/**
|
|
3586
|
+
* Try fallback positions for a control
|
|
3587
|
+
*
|
|
3588
|
+
* @returns The fallback position that worked, or null if none worked
|
|
3589
|
+
*/
|
|
3590
|
+
tryFallbackPositions(control, positionedBoxes) {
|
|
3591
|
+
const fallbacks = control.position.fallbacks || [];
|
|
3592
|
+
for (const fallbackPosition of fallbacks) {
|
|
3593
|
+
const dimensions = control.isExpanded && control.expandedDimensions ? control.expandedDimensions : control.dimensions;
|
|
3594
|
+
const newBox = this.calculateBoxAtPosition(fallbackPosition, dimensions);
|
|
3595
|
+
let isValid = true;
|
|
3596
|
+
for (const [otherId, otherBox] of positionedBoxes) {
|
|
3597
|
+
if (otherId === control.id) continue;
|
|
3598
|
+
const otherControl = this.controls.get(otherId);
|
|
3599
|
+
if (!otherControl) continue;
|
|
3600
|
+
if (this.boxesCollide(newBox, otherBox)) {
|
|
3601
|
+
isValid = false;
|
|
3602
|
+
break;
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3605
|
+
if (isValid && this.isBoxInViewport(newBox)) {
|
|
3606
|
+
positionedBoxes.set(control.id, newBox);
|
|
3607
|
+
let cssX = EDGE_MARGIN;
|
|
3608
|
+
let cssY = EDGE_MARGIN;
|
|
3609
|
+
if (fallbackPosition.includes("center")) {
|
|
3610
|
+
cssX = (this.mapDimensions.width - dimensions.width) / 2;
|
|
3611
|
+
}
|
|
3612
|
+
if (fallbackPosition.startsWith("middle")) {
|
|
3613
|
+
cssY = (this.mapDimensions.height - dimensions.height) / 2;
|
|
3614
|
+
} else if (fallbackPosition === "bottom-right") {
|
|
3615
|
+
cssY = EDGE_MARGIN + ATTRIBUTION_HEIGHT;
|
|
3616
|
+
}
|
|
3617
|
+
const offset = this.offsets.get(control.id);
|
|
3618
|
+
if (offset) {
|
|
3619
|
+
offset.x = cssX;
|
|
3620
|
+
offset.y = cssY;
|
|
3621
|
+
offset.position = fallbackPosition;
|
|
3622
|
+
offset.visible = true;
|
|
3623
|
+
}
|
|
3624
|
+
return fallbackPosition;
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
return null;
|
|
3628
|
+
}
|
|
3629
|
+
/**
|
|
3630
|
+
* Calculate absolute bounding box for a control at a specific position
|
|
3631
|
+
* Returns absolute coordinates for collision detection
|
|
3632
|
+
*/
|
|
3633
|
+
calculateBoxAtPosition(position, dimensions) {
|
|
3634
|
+
const isCenterHorizontal = position.includes("center");
|
|
3635
|
+
const isRightPosition = position.includes("right");
|
|
3636
|
+
const isBottomPosition = position.startsWith("bottom");
|
|
3637
|
+
const isMiddleVertical = position.startsWith("middle");
|
|
3638
|
+
let x = EDGE_MARGIN;
|
|
3639
|
+
if (isCenterHorizontal) {
|
|
3640
|
+
x = (this.mapDimensions.width - dimensions.width) / 2;
|
|
3641
|
+
} else if (isRightPosition) {
|
|
3642
|
+
x = this.mapDimensions.width - dimensions.width - EDGE_MARGIN;
|
|
3643
|
+
}
|
|
3644
|
+
const attributionOffset = position === "bottom-right" ? ATTRIBUTION_HEIGHT : 0;
|
|
3645
|
+
let y = EDGE_MARGIN;
|
|
3646
|
+
if (isBottomPosition) {
|
|
3647
|
+
y = this.mapDimensions.height - dimensions.height - EDGE_MARGIN - attributionOffset;
|
|
3648
|
+
} else if (isMiddleVertical) {
|
|
3649
|
+
y = (this.mapDimensions.height - dimensions.height) / 2;
|
|
3650
|
+
}
|
|
3651
|
+
return {
|
|
3652
|
+
left: x,
|
|
3653
|
+
top: y,
|
|
3654
|
+
right: x + dimensions.width,
|
|
3655
|
+
bottom: y + dimensions.height
|
|
3656
|
+
};
|
|
3657
|
+
}
|
|
3658
|
+
/**
|
|
3659
|
+
* Emit an event to all listeners
|
|
3660
|
+
*/
|
|
3661
|
+
emit(type, controlId) {
|
|
3662
|
+
const event = {
|
|
3663
|
+
type,
|
|
3664
|
+
controlId,
|
|
3665
|
+
offsets: this.getAllOffsets(),
|
|
3666
|
+
timestamp: Date.now()
|
|
3667
|
+
};
|
|
3668
|
+
for (const listener of this.listeners) {
|
|
3669
|
+
try {
|
|
3670
|
+
listener(event);
|
|
3671
|
+
} catch (error) {
|
|
3672
|
+
console.error("PositioningCoordinator: Error in event listener", error);
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
/**
|
|
3677
|
+
* Clear all registrations and reset state
|
|
3678
|
+
*/
|
|
3679
|
+
destroy() {
|
|
3680
|
+
this.controls.clear();
|
|
3681
|
+
this.offsets.clear();
|
|
3682
|
+
this.listeners.clear();
|
|
3683
|
+
this.mapDimensions = { width: 0, height: 0 };
|
|
3684
|
+
}
|
|
3685
|
+
};
|
|
3686
|
+
function createPositioningCoordinator() {
|
|
3687
|
+
return new PositioningCoordinator();
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3323
3690
|
// src/colors/realEstate.ts
|
|
3324
3691
|
var lotAvailabilityColors = {
|
|
3325
3692
|
Available: "#4caf50",
|
|
@@ -3434,4 +3801,4 @@ function createMatchedColorExpression(baseColorExpression, matchedProperty = "ma
|
|
|
3434
3801
|
];
|
|
3435
3802
|
}
|
|
3436
3803
|
|
|
3437
|
-
export {
|
|
3804
|
+
export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, CATEGORY_META, CITY_LIMITS, CLASSIC_DARK, CLASSIC_LIGHT, DEFAULT_SIMPLIFICATION_THRESHOLDS, EDGE_MARGIN, FLOOD_ZONES, FREE_BASEMAPS, KEYBOARD_CONTROLS, MAPTILER_BASIC, MAPTILER_OUTDOOR, MAPTILER_SATELLITE, MAPTILER_STREETS, MARKER_PROTECTION_CLASS, OSM_STANDARD, PARKS, PRIORITY_ORDER, PositioningCoordinator, SCHOOL_DISTRICTS, SPORTS_FACILITIES, STACK_GAP, STADIA_ALIDADE_DARK, STADIA_ALIDADE_SMOOTH, STADIA_STAMEN_TERRAIN, STADIA_STAMEN_TONER, STADIA_STAMEN_WATERCOLOR, TRAILS, TRANSIT_ROUTES, WATERSHEDS, ZONING_DISTRICTS, Z_INDEX_LAYERS, applyMarkerChildProtection, applyMarkerProtection, boundaryColors, boundsToPolygon, buildRTreeIndex, buildSpatialIndex, calculateBounds, calculateCentroid, calculateZoomThresholds, clusterColorExpression, clusterColors, combineBounds, countFeaturesByType, createCategoricalColorExpression, createCircleStyle, createContinuousColorExpression, createDynamicLODManager, createExtrusionHeightExpression, createExtrusionStyle, createFillStyle, createGeoJSONFingerprint, createHeatmapStyle, createHoverExpression, createIdleViewportManager, createInitialLayerStates, createInteractiveExpression, createInteractiveStatusColorExpression, createLineStyle, createLotFillStyle, createLotOutlineStyle, createMatchedColorExpression, createPositioningCoordinator, createPredictiveViewportManager, createRTreeViewportManager, createSelectionExpression, createStatusColorExpression, createViewportManager, createViewportQuery, createZoomExpression, decimalToDMS, deepEqual, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, filterEqual, fingerprintEqual, formatArea, formatBearing, formatBounds, formatCoordinates, formatDistance, formatFeatureProperties, formatLabel, formatPitch, formatPropertyValue, formatScale, formatZoom, generateBoundingPolygon, generateConvexHull, generateFeatureCollectionDescription, generateFeatureTable, generateKeyboardControlsDescription, generateLODData, generateLODDataWithSimplification, generateMapDescription, generateMarkerList, generateMarkersDescription, generateMoveAnnouncement, geoJSONEqual, getAvailabilityColor, getAvailableBasemaps, getChangedPaintProps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getContrastTextColor, getHighlightStyle, getLayerCategories, getLayerStatesArray, getLayerStyleForTheme, getLayersByCategory, getLayersWithErrors, getSelectionStyle, getSimplificationToleranceForZoom, getSimplifiedFeaturesForZoom, getSizeColor, getVisibleLayerIds, groupFeaturesByProperty, groupLayersByCategory, hideAllLayers, inventoryStatusColorExpression, inventoryStatusColors, isAnyLayerLoading, isClusterFeature, isValidBounds, loadGeoJSON, lotAvailabilityColorExpression, lotAvailabilityColors, lotSizeColorExpression, lotSizeColors, nonMatchedColor, paintPropsEqual, queryByBounds, queryByBoundsWithStats, queryRTreeByBounds, queryRTreeByBoundsWithStats, removeMarkerProtection, reorderLayers, resolveBasemapStyle, resolveBasemapThumbnail, resolveLayerSourceUrl, salesOfficeColor, searchLayers, serializeFilter, setLayerError, setLayerLoading, setLayerOpacity, showAllLayers, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, toggleLayerVisibility, updateLayerState, validateGeoJSON, zoomToScale };
|