Skip to content

Commit

Permalink
*** Version 2.6.4 ***
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrinegateau committed Jul 6, 2021
1 parent c953829 commit 48838da
Show file tree
Hide file tree
Showing 27 changed files with 113 additions and 44 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@types/leaflet": "^1.5.19",
"@types/leaflet.markercluster": "^1.4.3",
"boosted": "^4.6.0",
"iotmapmanager": "^2.6.3",
"iotmapmanager": "^2.6.4",
"leaflet": "^1.6.0",
"leaflet.markercluster": "^1.4.1",
"zone.js": "^0.11.3"
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/css/map.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/css/markers.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/css/popup.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/css/tabs.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/import_png.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/iot-map-manager.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iotmapmanager",
"version": "2.6.3",
"version": "2.6.4",
"description": "Manage markers, clusters, user marker or paths on IotMaps",
"main": "dist/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IotMapManager V2.6.3
# IotMapManager V2.6.4

This library provides management of markers dedicated to projects using mapping.
## use
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-area-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-area.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-cluster-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
6 changes: 5 additions & 1 deletion src/iotMapManager/src/iot-map-cluster.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -95,4 +95,8 @@ export class IotMapCluster extends IotMapDisplay {
this.map.getIotMap().flyTo(this.getData().location, (zoomLevel !== 18 ? zoomLevel + 1 : 18))
}
}

public isCluster (): boolean {
return true
}
}
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-common-svg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name: IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-icons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
67 changes: 56 additions & 11 deletions src/iotMapManager/src/iot-map-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -92,8 +92,8 @@ export class IotMapManager {
if (this.config.map.externalClustering) { // manual clustering
layer = new L.FeatureGroup()
layer.on('click', this.onElementClick.bind(this))
.on('mouseover', this.onMarkerMouseOver)
.on('mouseout', this.onMarkerMouseOut)
.on('mouseover', this.onElementMouseOver.bind(this))
.on('mouseout', this.onElementMouseOut)
} else if (layerName === this.config.accuracyCircle.layerName ||
layerName === this.config.userMarker.layerName ||
layerName === this.config.path.layerName) { // accuracy area, user marker or path = no clustering
Expand All @@ -106,7 +106,7 @@ export class IotMapManager {
})

layer.on('animationend', this.onZoom.bind(this))
.on('clustermouseover', this.onClusterMouseOver)
.on('clustermouseover', this.onClusterMouseOver.bind(this))
.on('clustermouseout', this.onClusterMouseOut)
.on('click', this.onElementClick.bind(this))
}
Expand Down Expand Up @@ -249,12 +249,20 @@ export class IotMapManager {
* @param event - event data
*/
private onElementClick (event) {
const element = event.layer
element.elementClicked() // informe cluster to open
if (this.selectedElement === element) {
this.unselectElement(element)
const element: IotMapDisplay = event.layer
if (this.config.map.externalClustering === true) {
if (element.isCluster()) {
element.elementClicked() // inform cluster to open
}
} else {
this.selectElement(element)
if (this.selectedElement === element) {
this.unselectElement(element)
} else {
this.selectElement(element)
if (element.hasPopup()) {
this.shiftMap(element.getData().location)
}
}
}
}

Expand All @@ -264,6 +272,7 @@ export class IotMapManager {
*/
private onClusterMouseOver (event) {
event.layer.setZIndexOffset(100)
this.shiftMap(event.latlng)
}

/**
Expand All @@ -278,15 +287,19 @@ export class IotMapManager {
* Called on marker mouse over (to brind manual cluster in front)
* @param event - event data
*/
private onMarkerMouseOver (event) {
private onElementMouseOver (event) {
event.layer.setZIndexOffset(100)

if (event.layer.isCluster()) {
this.shiftMap(event.layer.getData().location)
}
}

/**
* Called on marker mouse out (to brind manual cluster in background)
* @param event - event data
*/
private onMarkerMouseOut (event) {
private onElementMouseOut (event) {
event.layer.setZIndexOffset(0)
}

Expand Down Expand Up @@ -340,4 +353,36 @@ 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)
}
}
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-marker-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
15 changes: 14 additions & 1 deletion src/iotMapManager/src/iot-map-marker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -51,6 +51,11 @@ export class IotMapMarker extends IotMapDisplay {
this.selected = selected
this.setIcon(getMarkerIcon(this.data, this.config, selected))
this.setZIndexOffset((selected) ? 100 : 0)

// if (this.selected && this.data.popup !== undefined) {
// // move map if marker is too close to the edge
// this.shiftMap()
// }
}

public getData (): IotMarker {
Expand Down Expand Up @@ -109,4 +114,12 @@ export class IotMapMarker extends IotMapDisplay {
this.map.getLayer(this.config.accuracyCircle.layerName).removeLayer(this.accuracyCircle)
}
}

public isCluster (): boolean {
return false
}

public hasPopup (): boolean {
return this.data.popup !== undefined
}
}
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-path-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-path.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
8 changes: 7 additions & 1 deletion src/iotMapManager/src/iot-map-types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -52,6 +52,12 @@ export abstract class IotMapDisplay extends L.Marker {
// By default: Nothing to do
}

hasPopup (): boolean {
return false
}

abstract isCluster (): boolean

updateAccuracyDisplay (selectedLayers: string[], display: boolean): void { // eslint-disable-line @typescript-eslint/no-unused-vars
// By default: Nothing to do
}
Expand Down
2 changes: 1 addition & 1 deletion src/iotMapManager/src/iot-map-user-marker-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down
6 changes: 5 additions & 1 deletion src/iotMapManager/src/iot-map-user-marker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Software Name : IotMapManager
* Version: 2.6.3
* Version: 2.6.4
* SPDX-FileCopyrightText: Copyright (c) 2020 Orange
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -68,6 +68,10 @@ 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
Expand Down
Loading

0 comments on commit 48838da

Please sign in to comment.