ts-maps 0.2.5 → 0.2.6

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.
Files changed (59) hide show
  1. package/dist/components/base.d.ts +5 -7
  2. package/dist/components/concerns/interactable.d.ts +0 -6
  3. package/dist/components/line.d.ts +11 -11
  4. package/dist/components/marker.d.ts +24 -5
  5. package/dist/components/region.d.ts +28 -3
  6. package/dist/components/tooltip.d.ts +18 -76
  7. package/dist/core/apply-transform.d.ts +7 -47
  8. package/dist/core/coords-to-point.d.ts +9 -25
  9. package/dist/core/create-lines.d.ts +2 -39
  10. package/dist/core/create-markers.d.ts +2 -50
  11. package/dist/core/create-regions.d.ts +2 -22
  12. package/dist/core/create-series.d.ts +2 -19
  13. package/dist/core/get-inset-for-point.d.ts +3 -30
  14. package/dist/core/get-marker-position.d.ts +3 -12
  15. package/dist/core/index.d.ts +0 -23
  16. package/dist/core/reposition-labels.d.ts +2 -23
  17. package/dist/core/reposition-lines.d.ts +2 -32
  18. package/dist/core/reposition-markers.d.ts +2 -23
  19. package/dist/core/resize.d.ts +0 -2
  20. package/dist/core/set-focus.d.ts +2 -58
  21. package/dist/core/set-scale.d.ts +2 -80
  22. package/dist/core/setup-container-events.d.ts +2 -49
  23. package/dist/core/setup-container-touch-events.d.ts +2 -68
  24. package/dist/core/setup-element-events.d.ts +1 -131
  25. package/dist/core/setup-zoom-buttons.d.ts +2 -21
  26. package/dist/core/update-size.d.ts +2 -7
  27. package/dist/data-visualization.d.ts +14 -96
  28. package/dist/defaults/events.d.ts +0 -13
  29. package/dist/defaults/options.d.ts +0 -4
  30. package/dist/event-handler.d.ts +0 -11
  31. package/dist/index.d.ts +2 -10
  32. package/dist/legend.d.ts +8 -5
  33. package/dist/map.d.ts +78 -425
  34. package/dist/maps/brasil.d.ts +1 -0
  35. package/dist/maps/canada.d.ts +1 -0
  36. package/dist/maps/iraq.d.ts +0 -3
  37. package/dist/maps/italy.d.ts +1 -0
  38. package/dist/maps/russia.d.ts +0 -3
  39. package/dist/maps/spain.d.ts +1 -0
  40. package/dist/maps/us-aea-en.d.ts +0 -3
  41. package/dist/maps/us-lcc-en.d.ts +0 -3
  42. package/dist/maps/us-merc-en.d.ts +0 -3
  43. package/dist/maps/us-mill-en.d.ts +0 -3
  44. package/dist/maps/world-merc.d.ts +1 -0
  45. package/dist/maps/world.d.ts +1 -0
  46. package/dist/projection.d.ts +0 -17
  47. package/dist/scales/ordinal-scale.d.ts +4 -24
  48. package/dist/series.d.ts +13 -3
  49. package/dist/svg/base-element.d.ts +16 -2
  50. package/dist/svg/canvas-element.d.ts +20 -7
  51. package/dist/svg/image-element.d.ts +10 -5
  52. package/dist/svg/shape-element.d.ts +11 -2
  53. package/dist/svg/text-element.d.ts +6 -0
  54. package/dist/types.d.ts +32 -17
  55. package/dist/util/deep-merge.d.ts +1 -43
  56. package/dist/util/index.d.ts +6 -13
  57. package/dist/utils.d.ts +67 -3
  58. package/dist/vector-map.d.ts +2 -12
  59. package/package.json +1 -2
@@ -1,9 +1,3 @@
1
- declare interface BBox {
2
- x: number
3
- y: number
4
- width: number
5
- height: number
6
- }
7
1
  declare interface BaseComponentShape {
8
2
  remove: () => void
9
3
  setStyle: (property: string | Record<string, any>, value?: string | number) => void
@@ -15,5 +9,9 @@ declare interface BaseComponentShape {
15
9
  isSelected?: boolean
16
10
  updateStyle?: () => void
17
11
  }
18
-
12
+ declare class BaseComponent {
13
+ protected _tooltip?: HTMLElement;
14
+ protected shape?: BaseComponentShape;
15
+ dispose(): void;
16
+ }
19
17
  export default BaseComponent;
@@ -1,7 +1 @@
1
- declare interface Label {
2
- render?: (...args: any[]) => string
3
- offsets?: ((key: string) => [number, number]) | Array<[number, number]>
4
- }
5
- declare const params: any[];
6
-
7
1
  export default Interactable;
@@ -1,4 +1,4 @@
1
- declare const LINE_CLASS: 'jvm-line';
1
+ import BaseComponent from './base';
2
2
  declare interface LineOptions {
3
3
  index: string
4
4
  group: SVGElement
@@ -16,14 +16,14 @@ declare interface LineStyle {
16
16
  hover?: Record<string, string | number>
17
17
  selected?: Record<string, string | number>
18
18
  }
19
- declare const config: {
20
- d: unknown;
21
- fill: 'none';
22
- dataIndex: unknown
23
- };
24
- const { x1, y1, x2, y2 } = this._options
25
- return `M${x1},${y1}${this._getQCommand(x1, y1, x2, y2)}${x2},${y2}`
26
- }
27
- declare const curvature: unknown;
28
-
19
+ declare class Line extends BaseComponent {
20
+ private _options: LineOptions;
21
+ private _style: LineStyle;
22
+ constructor(options: LineOptions, style: LineStyle);
23
+ setStyle(property: string, value: string | number): void;
24
+ getConfig(): any;
25
+ _draw(): void;
26
+ _getDAttribute(): string;
27
+ _getQCommand(x1: number, y1: number, x2: number, y2: number): string;
28
+ }
29
29
  export default Line;
@@ -1,4 +1,4 @@
1
- declare const NAME: 'marker' const JVM_PREFIX = 'jvm-' const MARKER_CLASS = `${JVM_PREFIX}element ${JVM_PREFIX}marker` const MARKER_LABEL_CLASS = `${JVM_PREFIX}element ${JVM_PREFIX}label`;
1
+ import BaseComponent from './base';
2
2
  declare interface MarkerOptions {
3
3
  index: string
4
4
  map: any
@@ -24,8 +24,27 @@ declare interface MarkerStyle {
24
24
  hover?: Record<string, any>
25
25
  selected?: Record<string, any>
26
26
  }
27
- declare const map: unknown;
28
- declare const shapeType: unknown;
29
- declare const labelText: unknown;
30
-
27
+ declare class Marker extends BaseComponent {
28
+ private _options: MarkerOptions;
29
+ private _style: MarkerStyle;
30
+ private _labelX: number | null;
31
+ private _labelY: number | null;
32
+ private _offsets: [number, number] | null;
33
+ private _isImage: boolean;
34
+ label?: any;
35
+ isHovered?: boolean;
36
+ isSelected: boolean;
37
+ setStyle: (property: string, value: any) => void;
38
+ remove: () => void;
39
+ hover: (state: boolean) => void;
40
+ select: (state: boolean) => void;
41
+ protected _setStatus: (property: string, state: boolean) => void;
42
+ constructor(options: MarkerOptions, style: MarkerStyle);
43
+ getConfig(): any;
44
+ updateLabelPosition(): void;
45
+ _draw(): void;
46
+ _drawLabel(): void;
47
+ getLabelText(key: string, label?: any): string | undefined;
48
+ getLabelOffsets(key: string, label?: any): [number, number];
49
+ }
31
50
  export default Marker;
@@ -1,3 +1,4 @@
1
+ import BaseComponent from './base';
1
2
  declare interface RegionOptions {
2
3
  map: any
3
4
  code: string
@@ -15,7 +16,31 @@ declare interface RegionStyle {
15
16
  hover?: Record<string, any>
16
17
  selected?: Record<string, any>
17
18
  }
18
- declare const text: unknown;
19
- declare const regionPath: unknown;
20
-
19
+ declare class Region extends BaseComponent {
20
+ private _map: any;
21
+ labelX: number;
22
+ labelY: number;
23
+ label?: any;
24
+ isHovered?: boolean;
25
+ isSelected: boolean;
26
+ shape: any;
27
+ setStyle: (property: string, value: any) => void;
28
+ remove: () => void;
29
+ hover: (state: boolean) => void;
30
+ select: (state: boolean) => void;
31
+ protected _setStatus: (property: string, state: boolean) => void;
32
+ constructor({
33
+ map,
34
+ code,
35
+ path,
36
+ style,
37
+ label,
38
+ labelStyle,
39
+ labelsGroup,
40
+ }: RegionOptions);
41
+ _createRegion(path: string, code: string, style: RegionStyle): any;
42
+ updateLabelPosition(): void;
43
+ getLabelText(key: string, label?: any): string | undefined;
44
+ getLabelOffsets(key: string, label?: any): [number, number];
45
+ }
21
46
  export default Region;
@@ -1,80 +1,22 @@
1
+ import { } from '../util';
2
+ import BaseComponent from './base';
1
3
  import type { MapInterface } from '../types';
2
-
3
4
  export declare class Tooltip extends BaseComponent {
4
- private _map: MapInterface
5
- protected _tooltip: HTMLElement
6
- private _hoveredRegion: string | null = null
7
- private _hoveredMarker: string | null = null
8
- private _customPositioning: boolean = true
9
-
10
- constructor(map: MapInterface) {
11
- super()
12
-
13
- this._map = map
14
- this._tooltip = createElement('div', 'jvm-tooltip', '')
15
- this._tooltip.style.display = 'none'
16
- this._map.container.appendChild(this._tooltip)
17
-
18
-
19
- return this
20
- }
21
-
22
- getElement(): HTMLElement {
23
- return this._tooltip
24
- }
25
-
26
- show(text: string): void {
27
- this._tooltip.style.display = 'block'
28
- this._tooltip.innerHTML = text
29
- this._tooltip.classList.add('active')
30
- }
31
-
32
- hide(): void {
33
- this._tooltip.style.display = 'none'
34
- this._tooltip.classList.remove('active')
35
- this._hoveredRegion = null
36
- this._hoveredMarker = null
37
- }
38
-
39
- text(text: string): void {
40
- if (this._tooltip) {
41
- this._tooltip.innerHTML = text
42
- }
43
- }
44
-
45
- html(html: string): void {
46
- if (this._tooltip) {
47
- this._tooltip.innerHTML = html
48
- }
49
- }
50
-
51
- css(css: Record<string, string>): this {
52
- if (this._customPositioning && (css.top || css.left)) {
53
- return this
54
- }
55
-
56
- for (const style in css) {
57
- this._tooltip.style[style as any] = css[style]
58
- }
59
-
60
- return this
61
- }
62
-
63
- setHoveredRegion(code: string): void {
64
- this._hoveredRegion = code
65
- }
66
-
67
- getHoveredRegion(): string | null {
68
- return this._hoveredRegion
69
- }
70
-
71
- setHoveredMarker(index: string): void {
72
- this._hoveredMarker = index
73
- }
74
-
75
- getHoveredMarker(): string | null {
76
- return this._hoveredMarker
77
- }
5
+ private _map: MapInterface;
6
+ protected _tooltip: HTMLElement;
7
+ private _hoveredRegion: string | null;
8
+ private _hoveredMarker: string | null;
9
+ private _customPositioning: boolean;
10
+ constructor(map: MapInterface);
11
+ getElement(): HTMLElement;
12
+ show(text: string): void;
13
+ hide(): void;
14
+ text(text: string): void;
15
+ html(html: string): void;
16
+ css(css: Record<string, string>): this;
17
+ setHoveredRegion(code: string): void;
18
+ getHoveredRegion(): string | null;
19
+ setHoveredMarker(index: string): void;
20
+ getHoveredMarker(): string | null;
78
21
  }
79
-
80
22
  export default Tooltip;
@@ -1,47 +1,7 @@
1
- export default function applyTransform(this: MapInterface): void {
2
- let maxTransX: number, maxTransY: number, minTransX: number, minTransY: number
3
-
4
- if (this._defaultWidth * this.scale <= this._width) {
5
- maxTransX = (this._width - this._defaultWidth * this.scale) / (2 * this.scale)
6
- minTransX = (this._width - this._defaultWidth * this.scale) / (2 * this.scale)
7
- }
8
- else {
9
- maxTransX = 0
10
- minTransX = (this._width - this._defaultWidth * this.scale) / this.scale
11
- }
12
-
13
- if (this._defaultHeight * this.scale <= this._height) {
14
- maxTransY = (this._height - this._defaultHeight * this.scale) / (2 * this.scale)
15
- minTransY = (this._height - this._defaultHeight * this.scale) / (2 * this.scale)
16
- }
17
- else {
18
- maxTransY = 0
19
- minTransY = (this._height - this._defaultHeight * this.scale) / this.scale
20
- }
21
-
22
- if (this.transY > maxTransY) {
23
- this.transY = maxTransY
24
- }
25
- else if (this.transY < minTransY) {
26
- this.transY = minTransY
27
- }
28
-
29
- if (this.transX > maxTransX) {
30
- this.transX = maxTransX
31
- }
32
- else if (this.transX < minTransX) {
33
- this.transX = minTransX
34
- }
35
-
36
- this.canvas.applyTransformParams(this.scale, this.transX, this.transY)
37
-
38
- if (this._markers) {
39
- this._repositionMarkers()
40
- }
41
-
42
- if (this._lines) {
43
- this._repositionLines()
44
- }
45
-
46
- this._repositionLabels()
47
- };
1
+ import type { MapInterface } from '../types';
2
+ /**
3
+ * Apply transformation to the map
4
+ * This function calculates the appropriate translation and scale values
5
+ * and applies them to the map canvas
6
+ */
7
+ export declare function applyTransform(this: MapInterface): void;
@@ -1,28 +1,12 @@
1
+ import type { MapInterface } from '../types';
2
+ /**
3
+ * Convert latitude and longitude to point coordinates
4
+ * @param lat - Latitude
5
+ * @param lng - Longitude
6
+ * @returns Point coordinates or false if the point is outside the map
7
+ */
8
+ export declare function coordsToPoint(this: MapInterface, lat: number, lng: number): Point | false;
1
9
  declare interface Point {
2
10
  x: number
3
11
  y: number
4
- }
5
-
6
- export default function coordsToPoint(this: MapInterface, lat: number, lng: number): Point | false {
7
- const projection = this.params.map?.projection || 'mercator'
8
- const coords = projection === 'mercator' ? this.mercator.convert(lat, lng) : this.miller.convert(lat, lng)
9
-
10
- if (coords === false) {
11
- return false
12
- }
13
-
14
- const inset = this.getInsetForPoint(coords.x, coords.y)
15
- if (!inset) {
16
- return false
17
- }
18
-
19
- const { bbox } = inset
20
-
21
- const x = (coords.x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale
22
- const y = (coords.y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale
23
-
24
- return {
25
- x: x + this.transX * this.scale + inset.left * this.scale,
26
- y: y + this.transY * this.scale + inset.top * this.scale,
27
- }
28
- };
12
+ }
@@ -1,39 +1,2 @@
1
- export default function createLines(this: MapInterface, lines: LineConfig[]): void {
2
- const markers = this._markers || {}
3
- const { style, elements: _, ...rest } = this.params.lines || {}
4
-
5
- let point1: { x: number, y: number } | false = false
6
- let point2: { x: number, y: number } | false = false
7
-
8
- for (const index in lines) {
9
- const lineConfig = lines[index]
10
-
11
- for (const { config: markerConfig } of Object.values(markers)) {
12
- if (markerConfig.name === lineConfig.from) {
13
- point1 = this.getMarkerPosition(markerConfig)
14
- }
15
-
16
- if (markerConfig.name === lineConfig.to) {
17
- point2 = this.getMarkerPosition(markerConfig)
18
- }
19
- }
20
-
21
- if (point1 !== false && point2 !== false) {
22
- this._lines = this._lines || {}
23
- this._lines[getLineUid(lineConfig.from, lineConfig.to)] = new Line(
24
- {
25
- index,
26
- map: this,
27
- group: this._linesGroup,
28
- config: lineConfig,
29
- x1: point1.x,
30
- y1: point1.y,
31
- x2: point2.x,
32
- y2: point2.y,
33
- ...rest,
34
- },
35
- merge({ initial: style }, { initial: lineConfig.style || {} }, true),
36
- )
37
- }
38
- }
39
- };
1
+ import type { LineConfig, MapInterface } from '../types';
2
+ export declare function createLines(this: MapInterface, lines: LineConfig[]): void;
@@ -1,50 +1,2 @@
1
- export default function createMarkers(
2
- this: MapInterface,
3
- markers: Record<string, MarkerConfig> = {},
4
- isRecentlyCreated = false,
5
- ): void {
6
- for (let index in markers) {
7
- const config = markers[index]
8
- const point = this.getMarkerPosition(config)
9
- const uid = config.coords.join(':')
10
-
11
- if (!point) {
12
- continue
13
- }
14
-
15
- if (isRecentlyCreated) {
16
- if (
17
- Object.keys(this._markers || {}).filter(i => this._markers?.[i]._uid === uid).length
18
- ) {
19
- continue
20
- }
21
-
22
- index = String(Object.keys(this._markers || {}).length)
23
- }
24
-
25
- const marker = new Marker(
26
- {
27
- index,
28
- map: this,
29
- label: this.params.labels?.markers,
30
- labelsGroup: this._markerLabelsGroup,
31
- cx: point.x,
32
- cy: point.y,
33
- group: this._markersGroup,
34
- config,
35
- isRecentlyCreated,
36
- },
37
- merge({ initial: {} }, merge(this.params.markerStyle || {}, { ...(config.style || {}) }, true)),
38
- )
39
-
40
- if (this._markers?.[index]) {
41
- this.removeMarkers([index])
42
- }
43
-
44
- this._markers[index] = {
45
- _uid: uid,
46
- config,
47
- element: marker as unknown as MarkerInstance,
48
- }
49
- }
50
- };
1
+ import type { MapInterface, MarkerConfig } from '../types';
2
+ export declare function createMarkers(this: MapInterface, markers?: Record<string, MarkerConfig>, isRecentlyCreated?: any): void;
@@ -1,22 +1,2 @@
1
- export default function createRegions(this: MapInterface): void {
2
- this._regionLabelsGroup = this._regionLabelsGroup || this.canvas.createGroup('jvm-regions-labels-group')
3
-
4
- for (const code in this._mapData.paths) {
5
- const region = new Region({
6
- map: this,
7
- code,
8
- path: this._mapData.paths[code].path,
9
- style: merge({ initial: {} }, this.params.regionStyle || {}),
10
- labelStyle: this.params.regionLabelStyle,
11
- labelsGroup: this._regionLabelsGroup,
12
- label: this.params.labels?.regions ? {} : undefined,
13
- })
14
-
15
- this.regions[code] = {
16
- config: this._mapData.paths[code],
17
- element: region,
18
- path: this._mapData.paths[code].path,
19
- name: code,
20
- } as RegionType
21
- }
22
- };
1
+ import type { MapInterface } from '../types';
2
+ export declare function createRegions(this: MapInterface): void;
@@ -1,20 +1,3 @@
1
1
  import type { MapInterface } from '../types';
2
-
3
- declare type SeriesKey = 'markers' | 'regions'
4
-
5
- export default function createSeries(this: MapInterface): void {
6
- this.series = { markers: [], regions: [] }
7
-
8
- for (const key in this.params.series) {
9
- const seriesKey = key as SeriesKey
10
- if (this.params.series[seriesKey]) {
11
- for (let i = 0; i < this.params.series[seriesKey].length; i++) {
12
- this.series[seriesKey][i] = new Series(
13
- this.params.series[seriesKey][i],
14
- seriesKey === 'markers' ? (this._markers || {}) : this.regions,
15
- this,
16
- )
17
- }
18
- }
19
- }
20
- }
2
+ export declare function createSeries(this: MapInterface): void;
3
+ declare type SeriesKey = 'markers' | 'regions'
@@ -1,3 +1,5 @@
1
+ import type { MapInterface } from '../types';
2
+ export declare function getInsetForPoint(this: MapInterface, x: number, y: number): Inset | undefined;
1
3
  declare interface Point {
2
4
  x: number
3
5
  y: number
@@ -8,33 +10,4 @@ declare interface Inset {
8
10
  height: number
9
11
  left: number
10
12
  top: number
11
- [key: string]: any
12
- }
13
-
14
- export default function getInsetForPoint(this: MapInterface, x: number, y: number): Inset | undefined {
15
- const insets = Map.maps[this.params.map.name].insets
16
-
17
- if (!insets || insets.length === 0) {
18
- return undefined
19
- }
20
-
21
- for (let index = 0; index < insets.length; index++) {
22
- const inset = insets[index]
23
-
24
- if (!inset || !inset.bbox || inset.bbox.length < 2) {
25
- continue
26
- }
27
-
28
- const [start, end] = inset.bbox
29
-
30
- if (!start || !end) {
31
- continue
32
- }
33
-
34
- if (x > start.x && x < end.x && y > start.y && y < end.y) {
35
- return inset
36
- }
37
- }
38
-
39
- return undefined
40
- };
13
+ }
@@ -1,15 +1,6 @@
1
+ import type { MapInterface, MarkerConfig } from '../types';
2
+ export declare function getMarkerPosition(this: MapInterface, { coords }: MarkerConfig): Point | false;
1
3
  declare interface Point {
2
4
  x: number
3
5
  y: number
4
- }
5
-
6
- export default function getMarkerPosition(this: MapInterface, { coords }: MarkerConfig): Point | false {
7
- if (Map.maps[this.params.map.name].projection) {
8
- return this.coordsToPoint(...coords)
9
- }
10
-
11
- return {
12
- x: coords[0] * this.scale + this.transX * this.scale,
13
- y: coords[1] * this.scale + this.transY * this.scale,
14
- }
15
- };
6
+ }
@@ -1,24 +1 @@
1
- declare interface CoreModule {
2
- _setupContainerEvents: typeof _setupContainerEvents
3
- _setupElementEvents: typeof _setupElementEvents
4
- _setupZoomButtons: typeof _setupZoomButtons
5
- _setupContainerTouchEvents: typeof _setupContainerTouchEvents
6
- _createRegions: typeof _createRegions
7
- _createLines: typeof _createLines
8
- _createMarkers: typeof _createMarkers
9
- _createSeries: typeof _createSeries
10
- _applyTransform: typeof _applyTransform
11
- _resize: typeof _resize
12
- _setScale: typeof _setScale
13
- setFocus: typeof setFocus
14
- updateSize: typeof updateSize
15
- coordsToPoint: typeof coordsToPoint
16
- getInsetForPoint: typeof getInsetForPoint
17
- getMarkerPosition: typeof getMarkerPosition
18
- _repositionLines: typeof _repositionLines
19
- _repositionMarkers: typeof _repositionMarkers
20
- _repositionLabels: typeof _repositionLabels
21
- }
22
- declare const core: CoreModule;
23
-
24
1
  export default core;
@@ -1,23 +1,2 @@
1
- export default function repositionLabels(this: MapInterface): void {
2
- const labels = this.params.labels || {}
3
-
4
- if (labels.regions) {
5
- for (const code in this.regions) {
6
- const region = this.regions[code] as any
7
-
8
- if (!region || !region.element || !region.element.label) {
9
- continue
10
- }
11
- region.element.updateLabelPosition()
12
- }
13
- }
14
-
15
- if (labels.markers) {
16
- for (const index in this._markers) {
17
- const marker = this._markers[index] as any
18
- if (marker.element && typeof marker.element.updateLabelPosition === 'function') {
19
- marker.element.updateLabelPosition()
20
- }
21
- }
22
- }
23
- };
1
+ import type { MapInterface } from '../types';
2
+ export declare function repositionLabels(this: MapInterface): void;
@@ -1,32 +1,2 @@
1
- export default function repositionLines(this: MapInterface): void {
2
- const curvature = (this.params.lines?.curvature as number) || 0.5
3
-
4
- Object.values(this._lines || {}).forEach((line: Line) => {
5
- const startMarker = Object.values(this._markers || {}).find(
6
- ({ config }) => config.name === line.getConfig().from,
7
- )
8
-
9
- const endMarker = Object.values(this._markers || {}).find(
10
- ({ config }) => config.name === line.getConfig().to,
11
- )
12
-
13
- if (startMarker && endMarker) {
14
- const point1 = this.getMarkerPosition(startMarker.config)
15
- const point2 = this.getMarkerPosition(endMarker.config)
16
-
17
- if (point1 && point2) {
18
- const { x: x1, y: y1 } = point1
19
- const { x: x2, y: y2 } = point2
20
-
21
- const midX = (x1 + x2) / 2
22
- const midY = (y1 + y2) / 2
23
- const curveX = midX + curvature * (y2 - y1)
24
- const curveY = midY - curvature * (x2 - x1)
25
-
26
- line.setStyle({
27
- d: `M${x1},${y1} Q${curveX},${curveY} ${x2},${y2}`,
28
- })
29
- }
30
- }
31
- })
32
- };
1
+ import type { MapInterface } from '../types';
2
+ export declare function repositionLines(this: MapInterface): void;
@@ -1,23 +1,2 @@
1
- export default function repositionMarkers(this: MapInterface): void {
2
- if (!this._markers)
3
- return
4
-
5
- for (const index in this._markers) {
6
- const marker = this._markers[index] as any
7
-
8
- if (!marker || !marker.element || !marker.element.shape)
9
- continue
10
-
11
- const point = this.getMarkerPosition(marker.config)
12
-
13
- if (point !== false) {
14
- const cx = Number.isNaN(point.x) ? 0 : point.x
15
- const cy = Number.isNaN(point.y) ? 0 : point.y
16
-
17
- marker.element.shape.set({
18
- cx,
19
- cy,
20
- })
21
- }
22
- }
23
- };
1
+ import type { MapInterface } from '../types';
2
+ export declare function repositionMarkers(this: MapInterface): void;
@@ -1,5 +1,3 @@
1
1
  import type { MapInterface } from '../types';
2
-
3
2
  export declare function resize(this: MapInterface): void;
4
-
5
3
  export default resize;