mahal_map 1.6.8 → 1.6.11

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 CHANGED
@@ -575,7 +575,7 @@ const measureTool = new MeasureTool(map, {
575
575
  | Опция | Тип | Описание |
576
576
  | ------------------- | ---------------------------------------- | ------------------------------------------------------------------------ |
577
577
  | `mode` | `"distance" \| "area"` | Режим по умолчанию. По умолчанию `"distance"`. |
578
- | `sourceIdPrefix` | `string` | Префикс id source/layer на карте. По умолчанию `"mahal-measure"`. |
578
+ | `sourceIdPrefix` | `string` | Префикс id source/layer на карте. По умолчанию генерируется уникальный (`"mahal-measure-1"`, `"mahal-measure-2"`, ...) — так несколько инструментов на одной карте не конфликтуют. Задайте явно, если нужен предсказуемый id. |
579
579
  | `style` | `MeasureStyleOptions` | Цвета и размеры точек/линий/заливки/бейджа. |
580
580
  | `icons` | `MeasureIcons` | SVG-иконки `trash` / `close` / `check` для бейджей. |
581
581
  | `labels` | `MeasureLabels` | Подписи единиц: `meters`, `kilometers`, `squareMeters`, `squareKilometers`. |
package/dist/index.d.mts CHANGED
@@ -230,14 +230,11 @@ interface MeasureStyleOptions {
230
230
  pointStrokeColor?: string;
231
231
  pointStrokeWidth?: number;
232
232
  pointRadius?: number;
233
- activePointColor?: string;
234
233
  lineColor?: string;
235
234
  lineWidth?: number;
236
235
  lineDasharray?: number[];
237
236
  fillColor?: string;
238
237
  fillOpacity?: number;
239
- labelColor?: string;
240
- labelHaloColor?: string;
241
238
  badgeBackground?: string;
242
239
  badgeTextColor?: string;
243
240
  badgeBorderRadius?: string;
@@ -280,6 +277,8 @@ declare class MeasureTool {
280
277
  private prefix;
281
278
  private style;
282
279
  private labels;
280
+ private originalCursor;
281
+ private layerHandlersBound;
283
282
  private pointsSourceId;
284
283
  private linesSourceId;
285
284
  private fillsSourceId;
@@ -314,6 +313,8 @@ declare class MeasureTool {
314
313
  private handleStyleLoad;
315
314
  private handleViewportChange;
316
315
  constructor(map: Map, options?: MeasureToolOptions);
316
+ private bindLayerHandlers;
317
+ private unbindLayerHandlers;
317
318
  start(mode?: MeasureMode): void;
318
319
  stop(): void;
319
320
  setMode(mode: MeasureMode): void;
@@ -338,6 +339,7 @@ declare class MeasureTool {
338
339
  private projectPoint;
339
340
  private closestPointOnSegment;
340
341
  private findClosestPointOnShape;
342
+ private queryPointsLayer;
341
343
  private isOverExistingPoint;
342
344
  private onLineMouseMove;
343
345
  private clearHoverInsert;
@@ -368,7 +370,18 @@ declare function lineLength(points: [number, number][]): number;
368
370
  * geodesic area) — accurate enough for on-map measurement at city scale.
369
371
  */
370
372
  declare function polygonArea(points: [number, number][]): number;
373
+ /**
374
+ * Area-weighted polygon centroid (shoelace-based), not a plain average of
375
+ * vertices — a vertex average drifts outside the shape for concave or
376
+ * unevenly-spaced polygons. Longitudes are unwrapped relative to the first
377
+ * point first so shapes crossing the antimeridian don't collapse toward 0.
378
+ */
371
379
  declare function polygonCentroid(points: [number, number][]): [number, number];
380
+ /**
381
+ * True midpoint along the line by cumulative length (not a vertex) — for an
382
+ * uneven polyline the point at index Math.floor(n/2) can sit far from the
383
+ * geometric middle. Longitude interpolation is antimeridian-aware.
384
+ */
372
385
  declare function midpoint(points: [number, number][]): [number, number];
373
386
 
374
387
  type index$1_MeasureIcons = MeasureIcons;
package/dist/index.d.ts CHANGED
@@ -230,14 +230,11 @@ interface MeasureStyleOptions {
230
230
  pointStrokeColor?: string;
231
231
  pointStrokeWidth?: number;
232
232
  pointRadius?: number;
233
- activePointColor?: string;
234
233
  lineColor?: string;
235
234
  lineWidth?: number;
236
235
  lineDasharray?: number[];
237
236
  fillColor?: string;
238
237
  fillOpacity?: number;
239
- labelColor?: string;
240
- labelHaloColor?: string;
241
238
  badgeBackground?: string;
242
239
  badgeTextColor?: string;
243
240
  badgeBorderRadius?: string;
@@ -280,6 +277,8 @@ declare class MeasureTool {
280
277
  private prefix;
281
278
  private style;
282
279
  private labels;
280
+ private originalCursor;
281
+ private layerHandlersBound;
283
282
  private pointsSourceId;
284
283
  private linesSourceId;
285
284
  private fillsSourceId;
@@ -314,6 +313,8 @@ declare class MeasureTool {
314
313
  private handleStyleLoad;
315
314
  private handleViewportChange;
316
315
  constructor(map: Map, options?: MeasureToolOptions);
316
+ private bindLayerHandlers;
317
+ private unbindLayerHandlers;
317
318
  start(mode?: MeasureMode): void;
318
319
  stop(): void;
319
320
  setMode(mode: MeasureMode): void;
@@ -338,6 +339,7 @@ declare class MeasureTool {
338
339
  private projectPoint;
339
340
  private closestPointOnSegment;
340
341
  private findClosestPointOnShape;
342
+ private queryPointsLayer;
341
343
  private isOverExistingPoint;
342
344
  private onLineMouseMove;
343
345
  private clearHoverInsert;
@@ -368,7 +370,18 @@ declare function lineLength(points: [number, number][]): number;
368
370
  * geodesic area) — accurate enough for on-map measurement at city scale.
369
371
  */
370
372
  declare function polygonArea(points: [number, number][]): number;
373
+ /**
374
+ * Area-weighted polygon centroid (shoelace-based), not a plain average of
375
+ * vertices — a vertex average drifts outside the shape for concave or
376
+ * unevenly-spaced polygons. Longitudes are unwrapped relative to the first
377
+ * point first so shapes crossing the antimeridian don't collapse toward 0.
378
+ */
371
379
  declare function polygonCentroid(points: [number, number][]): [number, number];
380
+ /**
381
+ * True midpoint along the line by cumulative length (not a vertex) — for an
382
+ * uneven polyline the point at index Math.floor(n/2) can sit far from the
383
+ * geometric middle. Longitude interpolation is antimeridian-aware.
384
+ */
372
385
  declare function midpoint(points: [number, number][]): [number, number];
373
386
 
374
387
  type index$1_MeasureIcons = MeasureIcons;