mirror of
https://github.com/symfony/ux-map.git
synced 2026-03-23 23:42:07 +01:00
Drop Biome.js for oxfmt and oxlint
This commit is contained in:
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,5 +1,4 @@
|
|||||||
Please do not submit any Pull Requests here. They will be closed.
|
## Please do not submit any Pull Requests here. They will be closed.
|
||||||
---
|
|
||||||
|
|
||||||
Please submit your PR here instead:
|
Please submit your PR here instead:
|
||||||
https://github.com/symfony/ux
|
https://github.com/symfony/ux
|
||||||
|
|||||||
30
.github/workflows/close-pull-request.yml
vendored
30
.github/workflows/close-pull-request.yml
vendored
@@ -1,20 +1,20 @@
|
|||||||
name: Close Pull Request
|
name: Close Pull Request
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened]
|
types: [opened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: superbrothers/close-pull-request@v3
|
- uses: superbrothers/close-pull-request@v3
|
||||||
with:
|
with:
|
||||||
comment: |
|
comment: |
|
||||||
Thanks for your Pull Request! We love contributions.
|
Thanks for your Pull Request! We love contributions.
|
||||||
|
|
||||||
However, you should instead open your PR on the main repository:
|
However, you should instead open your PR on the main repository:
|
||||||
https://github.com/symfony/ux
|
https://github.com/symfony/ux
|
||||||
|
|
||||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||||
We're looking forward to your PR there!
|
We're looking forward to your PR there!
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
branches: ["2.x"]
|
branches: ['2.x']
|
||||||
maintained_branches: ["2.x"]
|
maintained_branches: ['2.x']
|
||||||
doc_dir: "doc"
|
doc_dir: 'doc'
|
||||||
|
|||||||
87
CHANGELOG.md
87
CHANGELOG.md
@@ -2,33 +2,34 @@
|
|||||||
|
|
||||||
## 2.32
|
## 2.32
|
||||||
|
|
||||||
- Add `Map::removeAllMarkers()`, `Map::removeAllPolygons()`, `Map::removeAllPolylines()`, `Map::removeAllCircles()` and `Map::removeAllRectangles()` methods
|
- Add `Map::removeAllMarkers()`, `Map::removeAllPolygons()`, `Map::removeAllPolylines()`, `Map::removeAllCircles()` and `Map::removeAllRectangles()` methods
|
||||||
|
|
||||||
## 2.31
|
## 2.31
|
||||||
|
|
||||||
- Add `fitBoundsToMarkers` parameter to `ux_map()` Twig function
|
- Add `fitBoundsToMarkers` parameter to `ux_map()` Twig function
|
||||||
|
|
||||||
## 2.30
|
## 2.30
|
||||||
|
|
||||||
- Ensure compatibility with PHP 8.5
|
- Ensure compatibility with PHP 8.5
|
||||||
- Deprecate option `title` from `Polygon`, `Polyline`, `Rectangle` and `Circle` in favor of `infoWindow`
|
- Deprecate option `title` from `Polygon`, `Polyline`, `Rectangle` and `Circle` in favor of `infoWindow`
|
||||||
|
|
||||||
## 2.29.0
|
## 2.29.0
|
||||||
|
|
||||||
- Add Symfony 8 support
|
- Add Symfony 8 support
|
||||||
- Add `Cluster` class and `ClusteringAlgorithmInterface` with two implementations `GridClusteringAlgorithm` and `MortonClusteringAlgorithm`
|
- Add `Cluster` class and `ClusteringAlgorithmInterface` with two implementations `GridClusteringAlgorithm` and `MortonClusteringAlgorithm`
|
||||||
|
|
||||||
## 2.28
|
## 2.28
|
||||||
|
|
||||||
- Add `minZoom` and `maxZoom` options to `Map` to set the minimum and maximum zoom levels
|
- Add `minZoom` and `maxZoom` options to `Map` to set the minimum and maximum zoom levels
|
||||||
|
|
||||||
## 2.27
|
## 2.27
|
||||||
|
|
||||||
- The `fitBoundsToMarkers` option is not overridden anymore when using the `Map` LiveComponent, but now respects the value you defined.
|
- The `fitBoundsToMarkers` option is not overridden anymore when using the `Map` LiveComponent, but now respects the value you defined.
|
||||||
You may encounter unwanted behavior when adding/removing elements to the map.
|
You may encounter unwanted behavior when adding/removing elements to the map.
|
||||||
To use the previous behavior, you must call `$this->getMap()->fitBoundsToMarkers(false)` in your LiveComponent's live actions
|
To use the previous behavior, you must call `$this->getMap()->fitBoundsToMarkers(false)` in your LiveComponent's live actions
|
||||||
|
|
||||||
|
- Add support for creating `Circle` by passing a `Point` and a radius (in meters) to the `Circle` constructor, e.g.:
|
||||||
|
|
||||||
- Add support for creating `Circle` by passing a `Point` and a radius (in meters) to the `Circle` constructor, e.g.:
|
|
||||||
```php
|
```php
|
||||||
$map->addCircle(new Circle(
|
$map->addCircle(new Circle(
|
||||||
center: new Point(48.856613, 2.352222), // Paris
|
center: new Point(48.856613, 2.352222), // Paris
|
||||||
@@ -36,7 +37,8 @@ $map->addCircle(new Circle(
|
|||||||
));
|
));
|
||||||
```
|
```
|
||||||
|
|
||||||
- Add support for creating `Rectangle` by passing two `Point` instances to the `Rectangle` constructor, e.g.:
|
- Add support for creating `Rectangle` by passing two `Point` instances to the `Rectangle` constructor, e.g.:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$map->addRectangle(new Rectangle(
|
$map->addRectangle(new Rectangle(
|
||||||
southWest: new Point(48.856613, 2.352222), // Paris
|
southWest: new Point(48.856613, 2.352222), // Paris
|
||||||
@@ -44,8 +46,9 @@ $map->addRectangle(new Rectangle(
|
|||||||
));
|
));
|
||||||
```
|
```
|
||||||
|
|
||||||
- Deprecate property `rawOptions` from `ux:map:*:before-create` events, in favor of `bridgeOptions` instead.
|
- Deprecate property `rawOptions` from `ux:map:*:before-create` events, in favor of `bridgeOptions` instead.
|
||||||
- Map options can now be configured and overridden through the `ux:map:pre-connect` event:
|
- Map options can now be configured and overridden through the `ux:map:pre-connect` event:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
this.element.addEventListener('ux:map:pre-connect', (event) => {
|
this.element.addEventListener('ux:map:pre-connect', (event) => {
|
||||||
// Override the map center and zoom
|
// Override the map center and zoom
|
||||||
@@ -61,11 +64,13 @@ this.element.addEventListener('ux:map:pre-connect', (event) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
- Add `extra` data support to `Map`, which can be accessed in `ux:map:pre-connect` and `ux:map:connect` events
|
|
||||||
|
- Add `extra` data support to `Map`, which can be accessed in `ux:map:pre-connect` and `ux:map:connect` events
|
||||||
|
|
||||||
## 2.26
|
## 2.26
|
||||||
|
|
||||||
- Add support for creating `Polygon` with holes, by passing an array of `array<Point>` as `points` parameter to the `Polygon` constructor, e.g.:
|
- Add support for creating `Polygon` with holes, by passing an array of `array<Point>` as `points` parameter to the `Polygon` constructor, e.g.:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
// Draw a polygon with a hole in it, on the French map
|
// Draw a polygon with a hole in it, on the French map
|
||||||
$map->addPolygon(new Polygon(points: [
|
$map->addPolygon(new Polygon(points: [
|
||||||
@@ -89,43 +94,43 @@ $map->addPolygon(new Polygon(points: [
|
|||||||
|
|
||||||
## 2.25
|
## 2.25
|
||||||
|
|
||||||
- Downgrade PHP requirement from 8.3 to 8.1
|
- Downgrade PHP requirement from 8.3 to 8.1
|
||||||
|
|
||||||
## 2.24
|
## 2.24
|
||||||
|
|
||||||
- Installing the package in a Symfony app using Flex won't add the `@symfony/ux-map` dependency to the `package.json` file anymore.
|
- Installing the package in a Symfony app using Flex won't add the `@symfony/ux-map` dependency to the `package.json` file anymore.
|
||||||
- Add `Icon` to customize a `Marker` icon (URL or SVG content)
|
- Add `Icon` to customize a `Marker` icon (URL or SVG content)
|
||||||
- Add parameter `id` to `Marker`, `Polygon` and `Polyline` constructors
|
- Add parameter `id` to `Marker`, `Polygon` and `Polyline` constructors
|
||||||
- Add method `Map::removeMarker(string|Marker $markerOrId)`
|
- Add method `Map::removeMarker(string|Marker $markerOrId)`
|
||||||
- Add method `Map::removePolygon(string|Polygon $polygonOrId)`
|
- Add method `Map::removePolygon(string|Polygon $polygonOrId)`
|
||||||
- Add method `Map::removePolyline(string|Polyline $polylineOrId)`
|
- Add method `Map::removePolyline(string|Polyline $polylineOrId)`
|
||||||
|
|
||||||
## 2.23
|
## 2.23
|
||||||
|
|
||||||
- Add `DistanceUnit` to represent distance units (`m`, `km`, `miles`, `nmi`) and
|
- Add `DistanceUnit` to represent distance units (`m`, `km`, `miles`, `nmi`) and
|
||||||
ease conversion between units.
|
ease conversion between units.
|
||||||
- Add `DistanceCalculatorInterface` interface and three implementations:
|
- Add `DistanceCalculatorInterface` interface and three implementations:
|
||||||
`HaversineDistanceCalculator`, `SphericalCosineDistanceCalculator` and `VincentyDistanceCalculator`.
|
`HaversineDistanceCalculator`, `SphericalCosineDistanceCalculator` and `VincentyDistanceCalculator`.
|
||||||
- Add `CoordinateUtils` helper, to convert decimal coordinates (`43.2109`) in DMS (`56° 78' 90"`)
|
- Add `CoordinateUtils` helper, to convert decimal coordinates (`43.2109`) in DMS (`56° 78' 90"`)
|
||||||
|
|
||||||
## 2.22
|
## 2.22
|
||||||
|
|
||||||
- Add method `Symfony\UX\Map\Renderer\AbstractRenderer::tapOptions()`, to allow Renderer to modify options before rendering a Map.
|
- Add method `Symfony\UX\Map\Renderer\AbstractRenderer::tapOptions()`, to allow Renderer to modify options before rendering a Map.
|
||||||
- Add `ux_map.google_maps.default_map_id` configuration to set the Google ``Map ID``
|
- Add `ux_map.google_maps.default_map_id` configuration to set the Google `Map ID`
|
||||||
- Add `ComponentWithMapTrait` to ease maps integration in [Live Components](https://symfony.com/bundles/ux-live-component/current/index.html)
|
- Add `ComponentWithMapTrait` to ease maps integration in [Live Components](https://symfony.com/bundles/ux-live-component/current/index.html)
|
||||||
- Add `Polyline` support
|
- Add `Polyline` support
|
||||||
|
|
||||||
## 2.20
|
## 2.20
|
||||||
|
|
||||||
- Deprecate `render_map` Twig function (will be removed in 2.21). Use
|
- Deprecate `render_map` Twig function (will be removed in 2.21). Use
|
||||||
`ux_map` or the `<twig:ux:map />` Twig component instead.
|
`ux_map` or the `<twig:ux:map />` Twig component instead.
|
||||||
- Add `ux_map` Twig function (replaces `render_map` with a more flexible
|
- Add `ux_map` Twig function (replaces `render_map` with a more flexible
|
||||||
interface)
|
interface)
|
||||||
- Add `<twig:ux:map />` Twig component
|
- Add `<twig:ux:map />` Twig component
|
||||||
- The importmap entry `@symfony/ux-map/abstract-map-controller` can be removed
|
- The importmap entry `@symfony/ux-map/abstract-map-controller` can be removed
|
||||||
from your importmap, it is no longer needed.
|
from your importmap, it is no longer needed.
|
||||||
- Add `Polygon` support
|
- Add `Polygon` support
|
||||||
|
|
||||||
## 2.19
|
## 2.19
|
||||||
|
|
||||||
- Component added
|
- Component added
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ https://github.com/symfony/ux to create issues or submit pull requests.
|
|||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [Documentation](https://symfony.com/bundles/ux-map/current/index.html)
|
- [Documentation](https://symfony.com/bundles/ux-map/current/index.html)
|
||||||
- [Report issues](https://github.com/symfony/ux/issues) and
|
- [Report issues](https://github.com/symfony/ux/issues) and
|
||||||
[send Pull Requests](https://github.com/symfony/ux/pulls)
|
[send Pull Requests](https://github.com/symfony/ux/pulls)
|
||||||
in the [main Symfony UX repository](https://github.com/symfony/ux)
|
in the [main Symfony UX repository](https://github.com/symfony/ux)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This package is private and is not intended to be published on npm or installed.
|
|||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [Documentation](https://symfony.com/bundles/ux-map/current/index.html)
|
- [Documentation](https://symfony.com/bundles/ux-map/current/index.html)
|
||||||
- [Report issues](https://github.com/symfony/ux/issues) and
|
- [Report issues](https://github.com/symfony/ux/issues) and
|
||||||
[send Pull Requests](https://github.com/symfony/ux/pulls)
|
[send Pull Requests](https://github.com/symfony/ux/pulls)
|
||||||
in the [main Symfony UX repository](https://github.com/symfony/ux)
|
in the [main Symfony UX repository](https://github.com/symfony/ux)
|
||||||
|
|||||||
12
assets/dist/abstract_map_controller.d.ts
vendored
12
assets/dist/abstract_map_controller.d.ts
vendored
@@ -158,27 +158,27 @@ declare abstract class export_default<MapOptions, BridgeMapOptions, BridgeMap, B
|
|||||||
polylinesValueChanged(): void;
|
polylinesValueChanged(): void;
|
||||||
circlesValueChanged(): void;
|
circlesValueChanged(): void;
|
||||||
rectanglesValueChanged(): void;
|
rectanglesValueChanged(): void;
|
||||||
protected abstract doCreateMap({ definition }: {
|
protected abstract doCreateMap({ definition, }: {
|
||||||
definition: MapDefinition<MapOptions, BridgeMapOptions>;
|
definition: MapDefinition<MapOptions, BridgeMapOptions>;
|
||||||
}): BridgeMap;
|
}): BridgeMap;
|
||||||
protected abstract doFitBoundsToMarkers(): void;
|
protected abstract doFitBoundsToMarkers(): void;
|
||||||
protected abstract doCreateMarker({ definition }: {
|
protected abstract doCreateMarker({ definition, }: {
|
||||||
definition: MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions>;
|
definition: MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions>;
|
||||||
}): BridgeMarker;
|
}): BridgeMarker;
|
||||||
protected abstract doRemoveMarker(marker: BridgeMarker): void;
|
protected abstract doRemoveMarker(marker: BridgeMarker): void;
|
||||||
protected abstract doCreatePolygon({ definition }: {
|
protected abstract doCreatePolygon({ definition, }: {
|
||||||
definition: PolygonDefinition<BridgePolygonOptions, BridgeInfoWindowOptions>;
|
definition: PolygonDefinition<BridgePolygonOptions, BridgeInfoWindowOptions>;
|
||||||
}): BridgePolygon;
|
}): BridgePolygon;
|
||||||
protected abstract doRemovePolygon(polygon: BridgePolygon): void;
|
protected abstract doRemovePolygon(polygon: BridgePolygon): void;
|
||||||
protected abstract doCreatePolyline({ definition }: {
|
protected abstract doCreatePolyline({ definition, }: {
|
||||||
definition: PolylineDefinition<BridgePolylineOptions, BridgeInfoWindowOptions>;
|
definition: PolylineDefinition<BridgePolylineOptions, BridgeInfoWindowOptions>;
|
||||||
}): BridgePolyline;
|
}): BridgePolyline;
|
||||||
protected abstract doRemovePolyline(polyline: BridgePolyline): void;
|
protected abstract doRemovePolyline(polyline: BridgePolyline): void;
|
||||||
protected abstract doCreateCircle({ definition }: {
|
protected abstract doCreateCircle({ definition, }: {
|
||||||
definition: CircleDefinition<BridgeCircleOptions, BridgeInfoWindowOptions>;
|
definition: CircleDefinition<BridgeCircleOptions, BridgeInfoWindowOptions>;
|
||||||
}): BridgeCircle;
|
}): BridgeCircle;
|
||||||
protected abstract doRemoveCircle(circle: BridgeCircle): void;
|
protected abstract doRemoveCircle(circle: BridgeCircle): void;
|
||||||
protected abstract doCreateRectangle({ definition }: {
|
protected abstract doCreateRectangle({ definition, }: {
|
||||||
definition: RectangleDefinition<BridgeRectangleOptions, BridgeInfoWindowOptions>;
|
definition: RectangleDefinition<BridgeRectangleOptions, BridgeInfoWindowOptions>;
|
||||||
}): BridgeRectangle;
|
}): BridgeRectangle;
|
||||||
protected abstract doRemoveRectangle(rectangle: BridgeRectangle): void;
|
protected abstract doRemoveRectangle(rectangle: BridgeRectangle): void;
|
||||||
|
|||||||
6
assets/dist/abstract_map_controller.js
vendored
6
assets/dist/abstract_map_controller.js
vendored
@@ -31,7 +31,11 @@ var abstract_map_controller_default = class extends Controller {
|
|||||||
this.createPolygon = this.createDrawingFactory("polygon", this.polygons, this.doCreatePolygon.bind(this));
|
this.createPolygon = this.createDrawingFactory("polygon", this.polygons, this.doCreatePolygon.bind(this));
|
||||||
this.createPolyline = this.createDrawingFactory("polyline", this.polylines, this.doCreatePolyline.bind(this));
|
this.createPolyline = this.createDrawingFactory("polyline", this.polylines, this.doCreatePolyline.bind(this));
|
||||||
this.createCircle = this.createDrawingFactory("circle", this.circles, this.doCreateCircle.bind(this));
|
this.createCircle = this.createDrawingFactory("circle", this.circles, this.doCreateCircle.bind(this));
|
||||||
this.createRectangle = this.createDrawingFactory("rectangle", this.rectangles, this.doCreateRectangle.bind(this));
|
this.createRectangle = this.createDrawingFactory(
|
||||||
|
"rectangle",
|
||||||
|
this.rectangles,
|
||||||
|
this.doCreateRectangle.bind(this)
|
||||||
|
);
|
||||||
this.map = this.doCreateMap({ definition: mapDefinition });
|
this.map = this.doCreateMap({ definition: mapDefinition });
|
||||||
this.markersValue.forEach((definition) => {
|
this.markersValue.forEach((definition) => {
|
||||||
this.createMarker({ definition });
|
this.createMarker({ definition });
|
||||||
|
|||||||
@@ -22,9 +22,7 @@
|
|||||||
"build": "tsx ../../../bin/build_package.ts .",
|
"build": "tsx ../../../bin/build_package.ts .",
|
||||||
"watch": "tsx ../../../bin/build_package.ts . --watch",
|
"watch": "tsx ../../../bin/build_package.ts . --watch",
|
||||||
"test": "pnpm run test:unit",
|
"test": "pnpm run test:unit",
|
||||||
"test:unit": "../../../bin/unit_test_package.sh .",
|
"test:unit": "../../../bin/unit_test_package.sh ."
|
||||||
"check": "biome check",
|
|
||||||
"ci": "biome ci"
|
|
||||||
},
|
},
|
||||||
"symfony": {
|
"symfony": {
|
||||||
"needsPackageAsADependency": false,
|
"needsPackageAsADependency": false,
|
||||||
|
|||||||
@@ -282,11 +282,31 @@ export default abstract class<
|
|||||||
protected infoWindows: Array<BridgeInfoWindow> = [];
|
protected infoWindows: Array<BridgeInfoWindow> = [];
|
||||||
|
|
||||||
private isConnected = false;
|
private isConnected = false;
|
||||||
private createMarker: ({ definition }: { definition: MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> }) => BridgeMarker;
|
private createMarker: ({
|
||||||
private createPolygon: ({ definition }: { definition: PolygonDefinition<BridgePolygonOptions, BridgeInfoWindowOptions> }) => BridgePolygon;
|
definition,
|
||||||
private createPolyline: ({ definition }: { definition: PolylineDefinition<BridgePolylineOptions, BridgeInfoWindowOptions> }) => BridgePolyline;
|
}: {
|
||||||
private createCircle: ({ definition }: { definition: CircleDefinition<BridgeCircleOptions, BridgeInfoWindowOptions> }) => BridgeCircle;
|
definition: MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions>;
|
||||||
private createRectangle: ({ definition }: { definition: RectangleDefinition<BridgeRectangleOptions, BridgeInfoWindowOptions> }) => BridgeRectangle;
|
}) => BridgeMarker;
|
||||||
|
private createPolygon: ({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: PolygonDefinition<BridgePolygonOptions, BridgeInfoWindowOptions>;
|
||||||
|
}) => BridgePolygon;
|
||||||
|
private createPolyline: ({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: PolylineDefinition<BridgePolylineOptions, BridgeInfoWindowOptions>;
|
||||||
|
}) => BridgePolyline;
|
||||||
|
private createCircle: ({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: CircleDefinition<BridgeCircleOptions, BridgeInfoWindowOptions>;
|
||||||
|
}) => BridgeCircle;
|
||||||
|
private createRectangle: ({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: RectangleDefinition<BridgeRectangleOptions, BridgeInfoWindowOptions>;
|
||||||
|
}) => BridgeRectangle;
|
||||||
|
|
||||||
protected abstract dispatchEvent(name: string, payload: Record<string, unknown>): void;
|
protected abstract dispatchEvent(name: string, payload: Record<string, unknown>): void;
|
||||||
|
|
||||||
@@ -306,7 +326,11 @@ export default abstract class<
|
|||||||
this.createPolygon = this.createDrawingFactory('polygon', this.polygons, this.doCreatePolygon.bind(this));
|
this.createPolygon = this.createDrawingFactory('polygon', this.polygons, this.doCreatePolygon.bind(this));
|
||||||
this.createPolyline = this.createDrawingFactory('polyline', this.polylines, this.doCreatePolyline.bind(this));
|
this.createPolyline = this.createDrawingFactory('polyline', this.polylines, this.doCreatePolyline.bind(this));
|
||||||
this.createCircle = this.createDrawingFactory('circle', this.circles, this.doCreateCircle.bind(this));
|
this.createCircle = this.createDrawingFactory('circle', this.circles, this.doCreateCircle.bind(this));
|
||||||
this.createRectangle = this.createDrawingFactory('rectangle', this.rectangles, this.doCreateRectangle.bind(this));
|
this.createRectangle = this.createDrawingFactory(
|
||||||
|
'rectangle',
|
||||||
|
this.rectangles,
|
||||||
|
this.doCreateRectangle.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
this.map = this.doCreateMap({ definition: mapDefinition });
|
this.map = this.doCreateMap({ definition: mapDefinition });
|
||||||
this.markersValue.forEach((definition) => {
|
this.markersValue.forEach((definition) => {
|
||||||
@@ -418,27 +442,51 @@ export default abstract class<
|
|||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Abstract factory methods to be implemented by the concrete classes, they are specific to the map provider
|
//region Abstract factory methods to be implemented by the concrete classes, they are specific to the map provider
|
||||||
protected abstract doCreateMap({ definition }: { definition: MapDefinition<MapOptions, BridgeMapOptions> }): BridgeMap;
|
protected abstract doCreateMap({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: MapDefinition<MapOptions, BridgeMapOptions>;
|
||||||
|
}): BridgeMap;
|
||||||
|
|
||||||
protected abstract doFitBoundsToMarkers(): void;
|
protected abstract doFitBoundsToMarkers(): void;
|
||||||
|
|
||||||
protected abstract doCreateMarker({ definition }: { definition: MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> }): BridgeMarker;
|
protected abstract doCreateMarker({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions>;
|
||||||
|
}): BridgeMarker;
|
||||||
|
|
||||||
protected abstract doRemoveMarker(marker: BridgeMarker): void;
|
protected abstract doRemoveMarker(marker: BridgeMarker): void;
|
||||||
|
|
||||||
protected abstract doCreatePolygon({ definition }: { definition: PolygonDefinition<BridgePolygonOptions, BridgeInfoWindowOptions> }): BridgePolygon;
|
protected abstract doCreatePolygon({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: PolygonDefinition<BridgePolygonOptions, BridgeInfoWindowOptions>;
|
||||||
|
}): BridgePolygon;
|
||||||
|
|
||||||
protected abstract doRemovePolygon(polygon: BridgePolygon): void;
|
protected abstract doRemovePolygon(polygon: BridgePolygon): void;
|
||||||
|
|
||||||
protected abstract doCreatePolyline({ definition }: { definition: PolylineDefinition<BridgePolylineOptions, BridgeInfoWindowOptions> }): BridgePolyline;
|
protected abstract doCreatePolyline({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: PolylineDefinition<BridgePolylineOptions, BridgeInfoWindowOptions>;
|
||||||
|
}): BridgePolyline;
|
||||||
|
|
||||||
protected abstract doRemovePolyline(polyline: BridgePolyline): void;
|
protected abstract doRemovePolyline(polyline: BridgePolyline): void;
|
||||||
|
|
||||||
protected abstract doCreateCircle({ definition }: { definition: CircleDefinition<BridgeCircleOptions, BridgeInfoWindowOptions> }): BridgeCircle;
|
protected abstract doCreateCircle({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: CircleDefinition<BridgeCircleOptions, BridgeInfoWindowOptions>;
|
||||||
|
}): BridgeCircle;
|
||||||
|
|
||||||
protected abstract doRemoveCircle(circle: BridgeCircle): void;
|
protected abstract doRemoveCircle(circle: BridgeCircle): void;
|
||||||
|
|
||||||
protected abstract doCreateRectangle({ definition }: { definition: RectangleDefinition<BridgeRectangleOptions, BridgeInfoWindowOptions> }): BridgeRectangle;
|
protected abstract doCreateRectangle({
|
||||||
|
definition,
|
||||||
|
}: {
|
||||||
|
definition: RectangleDefinition<BridgeRectangleOptions, BridgeInfoWindowOptions>;
|
||||||
|
}): BridgeRectangle;
|
||||||
|
|
||||||
protected abstract doRemoveRectangle(rectangle: BridgeRectangle): void;
|
protected abstract doRemoveRectangle(rectangle: BridgeRectangle): void;
|
||||||
|
|
||||||
@@ -454,11 +502,31 @@ export default abstract class<
|
|||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Private APIs
|
//region Private APIs
|
||||||
private createDrawingFactory(type: 'marker', draws: typeof this.markers, factory: typeof this.doCreateMarker): typeof this.doCreateMarker;
|
private createDrawingFactory(
|
||||||
private createDrawingFactory(type: 'polygon', draws: typeof this.polygons, factory: typeof this.doCreatePolygon): typeof this.doCreatePolygon;
|
type: 'marker',
|
||||||
private createDrawingFactory(type: 'polyline', draws: typeof this.polylines, factory: typeof this.doCreatePolyline): typeof this.doCreatePolyline;
|
draws: typeof this.markers,
|
||||||
private createDrawingFactory(type: 'circle', draws: typeof this.circles, factory: typeof this.doCreateCircle): typeof this.doCreateCircle;
|
factory: typeof this.doCreateMarker
|
||||||
private createDrawingFactory(type: 'rectangle', draws: typeof this.rectangles, factory: typeof this.doCreateRectangle): typeof this.doCreateRectangle;
|
): typeof this.doCreateMarker;
|
||||||
|
private createDrawingFactory(
|
||||||
|
type: 'polygon',
|
||||||
|
draws: typeof this.polygons,
|
||||||
|
factory: typeof this.doCreatePolygon
|
||||||
|
): typeof this.doCreatePolygon;
|
||||||
|
private createDrawingFactory(
|
||||||
|
type: 'polyline',
|
||||||
|
draws: typeof this.polylines,
|
||||||
|
factory: typeof this.doCreatePolyline
|
||||||
|
): typeof this.doCreatePolyline;
|
||||||
|
private createDrawingFactory(
|
||||||
|
type: 'circle',
|
||||||
|
draws: typeof this.circles,
|
||||||
|
factory: typeof this.doCreateCircle
|
||||||
|
): typeof this.doCreateCircle;
|
||||||
|
private createDrawingFactory(
|
||||||
|
type: 'rectangle',
|
||||||
|
draws: typeof this.rectangles,
|
||||||
|
factory: typeof this.doCreateRectangle
|
||||||
|
): typeof this.doCreateRectangle;
|
||||||
private createDrawingFactory<
|
private createDrawingFactory<
|
||||||
Factory extends
|
Factory extends
|
||||||
| typeof this.doCreateMarker
|
| typeof this.doCreateMarker
|
||||||
@@ -467,7 +535,11 @@ export default abstract class<
|
|||||||
| typeof this.doCreateCircle
|
| typeof this.doCreateCircle
|
||||||
| typeof this.doCreateRectangle,
|
| typeof this.doCreateRectangle,
|
||||||
Draw extends ReturnType<Factory>,
|
Draw extends ReturnType<Factory>,
|
||||||
>(type: 'marker' | 'polygon' | 'polyline' | 'circle' | 'rectangle', draws: globalThis.Map<WithIdentifier<any>, Draw>, factory: Factory): Factory {
|
>(
|
||||||
|
type: 'marker' | 'polygon' | 'polyline' | 'circle' | 'rectangle',
|
||||||
|
draws: globalThis.Map<WithIdentifier<any>, Draw>,
|
||||||
|
factory: Factory
|
||||||
|
): Factory {
|
||||||
const eventBefore = `${type}:before-create`;
|
const eventBefore = `${type}:before-create`;
|
||||||
const eventAfter = `${type}:after-create`;
|
const eventAfter = `${type}:after-create`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user