fix spiderfication bug when max zoom is reached

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Julien Veyssier 2019-07-10 15:55:38 +02:00
Родитель d19783c055
Коммит 58b6a66c61
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4141FEE162030638
5 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -26,6 +26,7 @@ ContactsController.prototype = {
var that = this;
this.contactLayer = L.markerClusterGroup({
iconCreateFunction : this.getClusterIconCreateFunction(),
spiderfyOnMaxZoom: false,
showCoverageOnHover : false,
zoomToBoundsOnClick: false,
maxClusterRadius: this.contact_MARKER_VIEW_SIZE + 10,
@ -35,7 +36,7 @@ ContactsController.prototype = {
});
this.contactLayer.on('click', this.getContactMarkerOnClickFunction());
this.contactLayer.on('clusterclick', function (a) {
if (a.layer.getChildCount() > 20) {
if (a.layer.getChildCount() > 20 && that.map.getZoom() !== that.map.getMaxZoom()) {
a.layer.zoomToBounds();
}
else {

Просмотреть файл

@ -204,6 +204,7 @@ FavoritesController.prototype = {
this.cluster = L.markerClusterGroup({
iconCreateFunction: this.getClusterIconCreateFunction(),
spiderfyOnMaxZoom: false,
maxClusterRadius: 28,
zoomToBoundsOnClick: false,
chunkedLoading: true,
@ -212,7 +213,7 @@ FavoritesController.prototype = {
}
});
this.cluster.on('clusterclick', function (a) {
if (a.layer.getChildCount() > 20) {
if (a.layer.getChildCount() > 20 && that.map.getZoom() !== that.map.getMaxZoom()) {
a.layer.zoomToBounds();
}
else {

Просмотреть файл

@ -23,6 +23,7 @@ NonLocalizedPhotosController.prototype = {
var that = this;
this.nonLocalizedPhotoLayer = L.markerClusterGroup({
iconCreateFunction : this.getClusterIconCreateFunction(),
spiderfyOnMaxZoom: false,
showCoverageOnHover : false,
zoomToBoundsOnClick: false,
maxClusterRadius: this.PHOTO_MARKER_VIEW_SIZE + 10,
@ -32,7 +33,7 @@ NonLocalizedPhotosController.prototype = {
});
this.nonLocalizedPhotoLayer.on('click', this.getNonLocalizedPhotoMarkerOnClickFunction());
this.nonLocalizedPhotoLayer.on('clusterclick', function (a) {
if (a.layer.getChildCount() > 20) {
if (a.layer.getChildCount() > 20 && that.map.getZoom() !== that.map.getMaxZoom()) {
a.layer.zoomToBounds();
}
else {

Просмотреть файл

@ -22,6 +22,7 @@ PhotosController.prototype = {
var that = this;
this.photoLayer = L.markerClusterGroup({
iconCreateFunction : this.getClusterIconCreateFunction(),
spiderfyOnMaxZoom: false,
showCoverageOnHover : false,
zoomToBoundsOnClick: false,
maxClusterRadius: this.PHOTO_MARKER_VIEW_SIZE + 10,
@ -31,7 +32,7 @@ PhotosController.prototype = {
});
this.photoLayer.on('click', this.getPhotoMarkerOnClickFunction());
this.photoLayer.on('clusterclick', function (a) {
if (a.layer.getChildCount() > 20) {
if (a.layer.getChildCount() > 20 && that.map.getZoom() !== that.map.getMaxZoom()) {
a.layer.zoomToBounds();
}
else {

Просмотреть файл

@ -33,7 +33,7 @@
"leaflet-routing-machine": "^3.2.12",
"leaflet.featuregroup.subgroup": "^1.0.2",
"leaflet.locatecontrol": "^0.62.0",
"leaflet.markercluster": "^1.1.0",
"leaflet.markercluster": "^1.4.0",
"leaflet-mouse-position": "^1.0.4",
"leaflet-contextmenu": "^1.4.0",
"leaflet.elevation": "^0.0.3",