From 057725b3db9a95debb6ff033cb8652bd0e8a30c8 Mon Sep 17 00:00:00 2001 From: BRKP5614 Date: Tue, 6 Jul 2021 17:58:11 +0200 Subject: [PATCH] *** Version 2.6.5 *** --- package-lock.json | 6 +- package.json | 2 +- src/iotMapManager/css/map.css | 2 +- src/iotMapManager/css/markers.css | 2 +- src/iotMapManager/css/popup.css | 2 +- src/iotMapManager/css/tabs.css | 2 +- src/iotMapManager/import_png.d.ts | 2 +- src/iotMapManager/index.ts | 2 +- src/iotMapManager/iot-map-manager.css | 2 +- src/iotMapManager/package.json | 2 +- src/iotMapManager/readme.md | 2 +- src/iotMapManager/src/iot-map-area-manager.ts | 2 +- src/iotMapManager/src/iot-map-area.ts | 2 +- .../src/iot-map-cluster-manager.ts | 2 +- src/iotMapManager/src/iot-map-cluster.ts | 6 +- src/iotMapManager/src/iot-map-common-svg.ts | 2 +- src/iotMapManager/src/iot-map-config.ts | 2 +- src/iotMapManager/src/iot-map-icons.ts | 2 +- src/iotMapManager/src/iot-map-manager.ts | 58 +++---------------- .../src/iot-map-marker-manager.ts | 2 +- src/iotMapManager/src/iot-map-marker.ts | 38 ++++++++++-- src/iotMapManager/src/iot-map-path-manager.ts | 2 +- src/iotMapManager/src/iot-map-path.ts | 2 +- src/iotMapManager/src/iot-map-types.ts | 10 ++-- .../src/iot-map-user-marker-manager.ts | 2 +- src/iotMapManager/src/iot-map-user-marker.ts | 6 +- 26 files changed, 69 insertions(+), 95 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e051e73..b5f581d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10095,9 +10095,9 @@ } }, "iotmapmanager": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/iotmapmanager/-/iotmapmanager-2.6.4.tgz", - "integrity": "sha512-wRz7N9HE9enAORo8wQJmlldVKBL787BqFtPhxTj3cPO7HAGABmQWJG+QSt7zN+5/mXl/rvRqWzHv0gpApwZ34g==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/iotmapmanager/-/iotmapmanager-2.6.5.tgz", + "integrity": "sha512-lWc7+6ytexUFWsEVWVXG3TJjCmDIhdvg5p89fXUZv6EKvnEgoAxCbncB1HSTlEOc64vVYzIEJ6Dcx/332ek3IA==", "requires": { "@types/leaflet": "^1.5.19", "@types/leaflet.markercluster": "^1.4.3", diff --git a/package.json b/package.json index e34c98a4..80d21139 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@types/leaflet": "^1.5.19", "@types/leaflet.markercluster": "^1.4.3", "boosted": "^4.6.0", - "iotmapmanager": "^2.6.4", + "iotmapmanager": "^2.6.5", "leaflet": "^1.6.0", "leaflet.markercluster": "^1.4.1", "zone.js": "^0.11.3" diff --git a/src/iotMapManager/css/map.css b/src/iotMapManager/css/map.css index dff1cf07..62feb499 100644 --- a/src/iotMapManager/css/map.css +++ b/src/iotMapManager/css/map.css @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/css/markers.css b/src/iotMapManager/css/markers.css index f3827fe1..badb8fcf 100644 --- a/src/iotMapManager/css/markers.css +++ b/src/iotMapManager/css/markers.css @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/css/popup.css b/src/iotMapManager/css/popup.css index 0166a80b..a26e8e26 100644 --- a/src/iotMapManager/css/popup.css +++ b/src/iotMapManager/css/popup.css @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/css/tabs.css b/src/iotMapManager/css/tabs.css index 25b259e9..6c56c3f3 100644 --- a/src/iotMapManager/css/tabs.css +++ b/src/iotMapManager/css/tabs.css @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/import_png.d.ts b/src/iotMapManager/import_png.d.ts index b50129b7..a8518147 100644 --- a/src/iotMapManager/import_png.d.ts +++ b/src/iotMapManager/import_png.d.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/index.ts b/src/iotMapManager/index.ts index e13c69a6..135c75cc 100644 --- a/src/iotMapManager/index.ts +++ b/src/iotMapManager/index.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/iot-map-manager.css b/src/iotMapManager/iot-map-manager.css index 1afd23bc..b49320e4 100644 --- a/src/iotMapManager/iot-map-manager.css +++ b/src/iotMapManager/iot-map-manager.css @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/package.json b/src/iotMapManager/package.json index ddd55506..3a2a0405 100644 --- a/src/iotMapManager/package.json +++ b/src/iotMapManager/package.json @@ -1,6 +1,6 @@ { "name": "iotmapmanager", - "version": "2.6.4", + "version": "2.6.5", "description": "Manage markers, clusters, user marker or paths on IotMaps", "main": "dist/index.js", "types": "lib/index.d.ts", diff --git a/src/iotMapManager/readme.md b/src/iotMapManager/readme.md index f7a09e6a..76ecb27a 100644 --- a/src/iotMapManager/readme.md +++ b/src/iotMapManager/readme.md @@ -1,4 +1,4 @@ -# IotMapManager V2.6.4 +# IotMapManager V2.6.5 This library provides management of markers dedicated to projects using mapping. ## use diff --git a/src/iotMapManager/src/iot-map-area-manager.ts b/src/iotMapManager/src/iot-map-area-manager.ts index e071f402..c2607e47 100644 --- a/src/iotMapManager/src/iot-map-area-manager.ts +++ b/src/iotMapManager/src/iot-map-area-manager.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-area.ts b/src/iotMapManager/src/iot-map-area.ts index de9a7d3d..efb0b63b 100644 --- a/src/iotMapManager/src/iot-map-area.ts +++ b/src/iotMapManager/src/iot-map-area.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-cluster-manager.ts b/src/iotMapManager/src/iot-map-cluster-manager.ts index fd1bd7cd..f4be166d 100644 --- a/src/iotMapManager/src/iot-map-cluster-manager.ts +++ b/src/iotMapManager/src/iot-map-cluster-manager.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-cluster.ts b/src/iotMapManager/src/iot-map-cluster.ts index 139ca58e..36359aa3 100644 --- a/src/iotMapManager/src/iot-map-cluster.ts +++ b/src/iotMapManager/src/iot-map-cluster.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * @@ -95,8 +95,4 @@ export class IotMapCluster extends IotMapDisplay { this.map.getIotMap().flyTo(this.getData().location, (zoomLevel !== 18 ? zoomLevel + 1 : 18)) } } - - public isCluster (): boolean { - return true - } } diff --git a/src/iotMapManager/src/iot-map-common-svg.ts b/src/iotMapManager/src/iot-map-common-svg.ts index ef079565..844670b2 100644 --- a/src/iotMapManager/src/iot-map-common-svg.ts +++ b/src/iotMapManager/src/iot-map-common-svg.ts @@ -1,6 +1,6 @@ /* * Software Name: IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-config.ts b/src/iotMapManager/src/iot-map-config.ts index 628277c4..af4245e3 100644 --- a/src/iotMapManager/src/iot-map-config.ts +++ b/src/iotMapManager/src/iot-map-config.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-icons.ts b/src/iotMapManager/src/iot-map-icons.ts index 2aacd409..a9aaad40 100644 --- a/src/iotMapManager/src/iot-map-icons.ts +++ b/src/iotMapManager/src/iot-map-icons.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-manager.ts b/src/iotMapManager/src/iot-map-manager.ts index aa75e5a0..5163f459 100644 --- a/src/iotMapManager/src/iot-map-manager.ts +++ b/src/iotMapManager/src/iot-map-manager.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * @@ -250,20 +250,15 @@ export class IotMapManager { */ private onElementClick (event) { const element: IotMapDisplay = event.layer - if (this.config.map.externalClustering === true) { - if (element.isCluster()) { - element.elementClicked() // inform cluster to open - } + + if (this.selectedElement === element) { + this.unselectElement(element) } else { - if (this.selectedElement === element) { - this.unselectElement(element) - } else { - this.selectElement(element) - if (element.hasPopup()) { - this.shiftMap(element.getData().location) - } - } + this.selectElement(element) } + + element.elementClicked() // inform cluster to open + element.shiftMap() } /** @@ -272,7 +267,6 @@ export class IotMapManager { */ private onClusterMouseOver (event) { event.layer.setZIndexOffset(100) - this.shiftMap(event.latlng) } /** @@ -289,10 +283,6 @@ export class IotMapManager { */ private onElementMouseOver (event) { event.layer.setZIndexOffset(100) - - if (event.layer.isCluster()) { - this.shiftMap(event.layer.getData().location) - } } /** @@ -353,36 +343,4 @@ export class IotMapManager { elt.updateAccuracyDisplay(this.currentDisplayedLayers, this.accuracyDisplayed) } } - - private shiftMap (currentPos: L.LatLngExpression): void { - const eltPos = this.map.latLngToLayerPoint(currentPos) - const mapBounds = this.map.getBounds() - const northEastPos = this.map.latLngToLayerPoint(mapBounds.getNorthEast()) - const southWestPos = this.map.latLngToLayerPoint(mapBounds.getSouthWest()) - - // top - if (eltPos.y - northEastPos.y < 200) { - const shift = 200 - (eltPos.y - northEastPos.y) - northEastPos.y -= shift - southWestPos.y -= shift - } - - // left - if (eltPos.x - southWestPos.x < 150) { - const shift = 150 - (eltPos.x - southWestPos.x) - northEastPos.x -= shift - southWestPos.x -= shift - } - - // bottom - no need to shift - // right - if (northEastPos.x - eltPos.x < 150) { - const shift = 150 - (northEastPos.x - eltPos.x) - northEastPos.x += shift - southWestPos.x += shift - } - - const newMapBounds = L.latLngBounds(this.map.layerPointToLatLng(southWestPos), this.map.layerPointToLatLng(northEastPos)) - this.map.flyToBounds(newMapBounds) - } } diff --git a/src/iotMapManager/src/iot-map-marker-manager.ts b/src/iotMapManager/src/iot-map-marker-manager.ts index 9c00b2fc..2d896eaa 100644 --- a/src/iotMapManager/src/iot-map-marker-manager.ts +++ b/src/iotMapManager/src/iot-map-marker-manager.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-marker.ts b/src/iotMapManager/src/iot-map-marker.ts index dea3dd67..3013143a 100644 --- a/src/iotMapManager/src/iot-map-marker.ts +++ b/src/iotMapManager/src/iot-map-marker.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * @@ -115,11 +115,37 @@ export class IotMapMarker extends IotMapDisplay { } } - public isCluster (): boolean { - return false - } + public shiftMap (): void { + if (this.selected && this.data.popup !== undefined) { + const eltPos = this.map.getIotMap().latLngToLayerPoint(this.data.location) + const mapBounds = this.map.getIotMap().getBounds() + const northEastPos = this.map.getIotMap().latLngToLayerPoint(mapBounds.getNorthEast()) + const southWestPos = this.map.getIotMap().latLngToLayerPoint(mapBounds.getSouthWest()) + + // top + if (eltPos.y - northEastPos.y < 200) { + const shift = 200 - (eltPos.y - northEastPos.y) + northEastPos.y -= shift + southWestPos.y -= shift + } + + // left + if (eltPos.x - southWestPos.x < 150) { + const shift = 150 - (eltPos.x - southWestPos.x) + northEastPos.x -= shift + southWestPos.x -= shift + } - public hasPopup (): boolean { - return this.data.popup !== undefined + // bottom - no need to shift + // right + if (northEastPos.x - eltPos.x < 150) { + const shift = 150 - (northEastPos.x - eltPos.x) + northEastPos.x += shift + southWestPos.x += shift + } + + const newMapBounds = L.latLngBounds(this.map.getIotMap().layerPointToLatLng(southWestPos), this.map.getIotMap().layerPointToLatLng(northEastPos)) + this.map.getIotMap().flyToBounds(newMapBounds) + } } } diff --git a/src/iotMapManager/src/iot-map-path-manager.ts b/src/iotMapManager/src/iot-map-path-manager.ts index a9ecfb13..18934cdc 100644 --- a/src/iotMapManager/src/iot-map-path-manager.ts +++ b/src/iotMapManager/src/iot-map-path-manager.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-path.ts b/src/iotMapManager/src/iot-map-path.ts index b1f857e9..ecdd4737 100644 --- a/src/iotMapManager/src/iot-map-path.ts +++ b/src/iotMapManager/src/iot-map-path.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-types.ts b/src/iotMapManager/src/iot-map-types.ts index b914e7ce..425415e9 100644 --- a/src/iotMapManager/src/iot-map-types.ts +++ b/src/iotMapManager/src/iot-map-types.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * @@ -48,16 +48,14 @@ export abstract class IotMapDisplay extends L.Marker { // By default: Nothing to do } + // By default: Nothing to do elementClicked (): void { - // By default: Nothing to do } - hasPopup (): boolean { - return false + shiftMap (): void { + // By default: Nothing to do } - abstract isCluster (): boolean - updateAccuracyDisplay (selectedLayers: string[], display: boolean): void { // eslint-disable-line @typescript-eslint/no-unused-vars // By default: Nothing to do } diff --git a/src/iotMapManager/src/iot-map-user-marker-manager.ts b/src/iotMapManager/src/iot-map-user-marker-manager.ts index 9a6e0336..d922b6b8 100644 --- a/src/iotMapManager/src/iot-map-user-marker-manager.ts +++ b/src/iotMapManager/src/iot-map-user-marker-manager.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * diff --git a/src/iotMapManager/src/iot-map-user-marker.ts b/src/iotMapManager/src/iot-map-user-marker.ts index dc95f29f..c0fdab46 100644 --- a/src/iotMapManager/src/iot-map-user-marker.ts +++ b/src/iotMapManager/src/iot-map-user-marker.ts @@ -1,6 +1,6 @@ /* * Software Name : IotMapManager -* Version: 2.6.4 +* Version: 2.6.5 * SPDX-FileCopyrightText: Copyright (c) 2020 Orange * SPDX-License-Identifier: MIT * @@ -68,10 +68,6 @@ export class IotMapUserMarker extends IotMapDisplay { this.accuracyCircle.setLatLng(newLatLng) } - public isCluster (): boolean { - return false - } - public updateAccuracyDisplay (selectedLayers: string[], display: boolean): void { this.layerDisplayed = selectedLayers.includes(this.config.userMarker.layerName) this.accuracityDisplayed = display