@bmlt-enabled/croutonjs 3.20.0 → 3.20.2
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.
- package/crouton-core.css +5 -5
- package/crouton-core.js +22 -17
- package/crouton-core.min.css +1 -1
- package/crouton-core.min.js +1 -1
- package/crouton-gmaps.js +82 -43
- package/crouton-gmaps.min.js +1 -1
- package/crouton-map.js +62 -24
- package/crouton-map.min.js +1 -1
- package/crouton.css +7 -6
- package/crouton.js +84 -41
- package/crouton.min.css +1 -1
- package/crouton.min.js +1 -1
- package/crouton.nojquery.js +84 -41
- package/crouton.nojquery.min.js +1 -1
- package/package.json +1 -1
package/crouton-map.js
CHANGED
|
@@ -69,7 +69,11 @@ function MeetingMap(inConfig) {
|
|
|
69
69
|
if (gDelegate.createMap(inDiv, loc)) {
|
|
70
70
|
gDelegate.addListener('zoomend', function (ev) {
|
|
71
71
|
if (shouldRedrawMarkers() && gAllMeetings) {
|
|
72
|
-
|
|
72
|
+
if (listOnlyVisible) {
|
|
73
|
+
const oldValue = filterVisible(false);
|
|
74
|
+
searchResponseCallback();
|
|
75
|
+
filterVisible(oldValue);
|
|
76
|
+
} else searchResponseCallback();
|
|
73
77
|
}
|
|
74
78
|
}, false);
|
|
75
79
|
if (config.map_search) {
|
|
@@ -153,10 +157,10 @@ function MeetingMap(inConfig) {
|
|
|
153
157
|
controlDiv.querySelector("#nearbyMeetings").addEventListener('click', function (e) {
|
|
154
158
|
retrieveGeolocation().then(position => {
|
|
155
159
|
filterVisible(false);
|
|
156
|
-
gDelegate.setViewToPosition(position, filterMeetingsAndBounds);
|
|
160
|
+
gDelegate.setViewToPosition(position, filterMeetingsAndBounds, filterVisible);
|
|
157
161
|
}).catch(error => {
|
|
158
162
|
console.error(error.message);
|
|
159
|
-
|
|
163
|
+
jQuery('.geo').removeClass("hide").addClass("show").html(`<p>${error.message}</p>`);
|
|
160
164
|
});
|
|
161
165
|
dropdownContent = document.getElementById("map-menu-dropdown").style.display = "none";
|
|
162
166
|
});
|
|
@@ -173,9 +177,10 @@ function MeetingMap(inConfig) {
|
|
|
173
177
|
let dropdownContent = document.getElementById("map-menu-dropdown");
|
|
174
178
|
if (dropdownContent.style.display == "inline-block") {
|
|
175
179
|
dropdownContent.style.display = "none";
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
} else {
|
|
181
|
+
jQuery("#filteringByVisibility").html(listOnlyVisible?'✔':'');
|
|
178
182
|
dropdownContent.style.display = "inline-block";
|
|
183
|
+
}
|
|
179
184
|
});
|
|
180
185
|
[...controlDiv.getElementsByClassName('modal-close')].forEach((elem)=>elem.addEventListener('click', (e)=>closeModalWindow(e.target)));
|
|
181
186
|
controlDiv.querySelector("#close_table").addEventListener('click', hideListView);
|
|
@@ -222,7 +227,7 @@ function MeetingMap(inConfig) {
|
|
|
222
227
|
function filterFromCrouton(filter) {
|
|
223
228
|
gMeetingIdsFromCrouton = filter;
|
|
224
229
|
if (gAllMeetings)
|
|
225
|
-
searchResponseCallback(fitDuringFilter);
|
|
230
|
+
searchResponseCallback(fitDuringFilter && !listOnlyVisible);
|
|
226
231
|
};
|
|
227
232
|
function nearMeSearch() {
|
|
228
233
|
retrieveGeolocation().then(position => {
|
|
@@ -235,7 +240,7 @@ function MeetingMap(inConfig) {
|
|
|
235
240
|
});
|
|
236
241
|
};
|
|
237
242
|
function clickSearch(e) {
|
|
238
|
-
croutonMap.showMap();
|
|
243
|
+
croutonMap.showMap(false,false);
|
|
239
244
|
gDelegate.clickSearch(e, function(lat,lng) {
|
|
240
245
|
showThrobber();
|
|
241
246
|
crouton.searchByCoordinates(lat, lng, config.map_search.width);
|
|
@@ -300,20 +305,23 @@ function MeetingMap(inConfig) {
|
|
|
300
305
|
}
|
|
301
306
|
searchResponseCallback();
|
|
302
307
|
hideThrobber();
|
|
308
|
+
if (config.filter_visible || config.centerMe || config.goto) crouton.forceShowMap();
|
|
303
309
|
if (config.centerMe) {
|
|
304
310
|
if (navigator.geolocation) {
|
|
305
311
|
navigator.geolocation.getCurrentPosition(
|
|
306
312
|
function (position) {
|
|
307
313
|
coords = {latitude: position.coords.latitude, longitude: position.coords.longitude};
|
|
308
|
-
|
|
314
|
+
filterVisible(false);
|
|
315
|
+
gDelegate.setViewToPosition(coords, filterMeetingsAndBounds, filterVisible);
|
|
309
316
|
},
|
|
310
317
|
showGeocodingDialog
|
|
311
318
|
);
|
|
312
319
|
} else if (fitAll) {
|
|
313
320
|
showGeocodingDialog();
|
|
314
321
|
}
|
|
315
|
-
} else
|
|
316
|
-
|
|
322
|
+
} else {
|
|
323
|
+
if (!config.centerMe && !config.goto) gDelegate.afterInit(()=>filterVisible(config.filter_visible));
|
|
324
|
+
if (config.goto) gDelegate.callGeocoder(config.goto, resetVisibleThenFilterMeetingsAndBounds);
|
|
317
325
|
}
|
|
318
326
|
}
|
|
319
327
|
function createCityHash(allMeetings) {
|
|
@@ -407,7 +415,9 @@ function MeetingMap(inConfig) {
|
|
|
407
415
|
}
|
|
408
416
|
function resetVisibleThenFilterMeetingsAndBounds(bounds) {
|
|
409
417
|
filterVisible(false);
|
|
410
|
-
filterMeetingsAndBounds(bounds);
|
|
418
|
+
const ret = filterMeetingsAndBounds(bounds);
|
|
419
|
+
filterVisible(true);
|
|
420
|
+
return ret;
|
|
411
421
|
}
|
|
412
422
|
function lookupLocation(fullscreen) {
|
|
413
423
|
if (document.getElementById('goto-text').value != '') {
|
|
@@ -579,11 +589,16 @@ function MeetingMap(inConfig) {
|
|
|
579
589
|
marker_html, null ,meetings.map((m)=>parseInt(m.id_bigint)));
|
|
580
590
|
};
|
|
581
591
|
var listOnlyVisible = false;
|
|
592
|
+
var listener = null;
|
|
582
593
|
function filterBounds(bounds) {
|
|
583
594
|
return gAllMeetings.filter((meeting) => gDelegate.contains(bounds, meeting.latitude, meeting.longitude));
|
|
584
595
|
}
|
|
596
|
+
function showAllMeetings() {
|
|
597
|
+
filterVisible(false);
|
|
598
|
+
gDelegate.addListener('dragend', filterVisible, true);
|
|
599
|
+
}
|
|
585
600
|
function filterVisible(on=true) {
|
|
586
|
-
if (on
|
|
601
|
+
if (on==listOnlyVisible) return on;
|
|
587
602
|
let mtgs = on ? filterBounds(gDelegate.getBounds()) : gAllMeetings;
|
|
588
603
|
let visible = mtgs.map((m)=>m.id_bigint);
|
|
589
604
|
jQuery(".bmlt-data-row").each(function(index,row) {
|
|
@@ -596,6 +611,12 @@ function MeetingMap(inConfig) {
|
|
|
596
611
|
fitDuringFilter = true;
|
|
597
612
|
jQuery("#filteringByVisibility").html(on?'✔':'');
|
|
598
613
|
listOnlyVisible = on;
|
|
614
|
+
if (on) listener = gDelegate.addListener('dragstart', showAllMeetings, true);
|
|
615
|
+
else if (listener) {
|
|
616
|
+
gDelegate.removeListener(listener);
|
|
617
|
+
listener = null;
|
|
618
|
+
}
|
|
619
|
+
return !on;
|
|
599
620
|
}
|
|
600
621
|
function toggleVisible() {
|
|
601
622
|
filterVisible(!listOnlyVisible);
|
|
@@ -677,14 +698,14 @@ function MeetingMap(inConfig) {
|
|
|
677
698
|
}
|
|
678
699
|
gDelegate.invalidateSize();
|
|
679
700
|
}
|
|
680
|
-
function showMap(isModal=false) {
|
|
701
|
+
function showMap(isModal=false, fitBounds=true) {
|
|
681
702
|
if (isModal && gModalDelegate) {
|
|
682
703
|
gModalDelegate.invalidateSize();
|
|
683
704
|
return;
|
|
684
705
|
}
|
|
685
706
|
gDelegate.invalidateSize();
|
|
686
707
|
if (!gAllMeetings) return;
|
|
687
|
-
gDelegate.fitBounds(
|
|
708
|
+
if (fitBounds) gDelegate.fitBounds(
|
|
688
709
|
((gMeetingIdsFromCrouton) ? gAllMeetings.filter((m) => gMeetingIdsFromCrouton.includes(m.id_bigint)) : gAllMeetings)
|
|
689
710
|
.reduce(function(a,m) {a.push([m.latitude, m.longitude]); return a;},[])
|
|
690
711
|
);
|
|
@@ -702,6 +723,7 @@ function MeetingMap(inConfig) {
|
|
|
702
723
|
this.openModalWindow = openModalWindow;
|
|
703
724
|
this.closeModalWindow = closeModalWindow;
|
|
704
725
|
this.loadPopupMap = loadPopupMap;
|
|
726
|
+
this.filterVisible = filterVisible;
|
|
705
727
|
};
|
|
706
728
|
MeetingMap.prototype.initialize = null;
|
|
707
729
|
MeetingMap.prototype.showMap = null;
|
|
@@ -713,6 +735,7 @@ MeetingMap.prototype.refreshMeetings = null;
|
|
|
713
735
|
MeetingMap.prototype.openModalWindow = null;
|
|
714
736
|
MeetingMap.prototype.closeModalWindow = null;
|
|
715
737
|
MeetingMap.prototype.loadPopupMap = null;
|
|
738
|
+
MeetingMap.prototype.filterVisible = null;
|
|
716
739
|
|
|
717
740
|
function MapDelegate(config) {
|
|
718
741
|
var g_icon_image_single = L.icon({
|
|
@@ -781,25 +804,33 @@ function MapDelegate(config) {
|
|
|
781
804
|
if (ev=='idle') {
|
|
782
805
|
ev = 'moveend';
|
|
783
806
|
}
|
|
807
|
+
if (ev=='dragstart') {
|
|
808
|
+
ev = 'movestart';
|
|
809
|
+
}
|
|
810
|
+
if (ev=='dragend') {
|
|
811
|
+
ev = 'moveend';
|
|
812
|
+
}
|
|
784
813
|
if (once) {
|
|
785
814
|
gMainMap.once(ev, f);
|
|
786
815
|
} else {
|
|
787
816
|
gMainMap.on(ev, f);
|
|
788
817
|
}
|
|
818
|
+
return {'event': ev, 'f': f};
|
|
789
819
|
}
|
|
820
|
+
function removeListener(o) {
|
|
821
|
+
gMainMap.off(o.event, o.f);
|
|
822
|
+
}
|
|
790
823
|
function setViewToPosition(position, filterMeetings, extra=null) {
|
|
791
824
|
var latlng = L.latLng(position.latitude, position.longitude);
|
|
792
825
|
gMainMap.flyTo(latlng);
|
|
793
|
-
gMainMap.
|
|
794
|
-
gMainMap.off('moveend');
|
|
826
|
+
gMainMap.once('moveend', function(ev) {
|
|
795
827
|
newZoom = getZoomAdjust(false, filterMeetings);
|
|
796
828
|
if (gMainMap.getZoom() != newZoom) {
|
|
797
829
|
gMainMap.setZoom(newZoom);
|
|
798
|
-
gMainMap.
|
|
799
|
-
gMainMap.off('zoomend');
|
|
830
|
+
gMainMap.once('zoomend',function() {
|
|
800
831
|
gMainMap.invalidateSize();
|
|
801
832
|
if (extra) {
|
|
802
|
-
gMainMap.
|
|
833
|
+
gMainMap.once('load moveend', extra);
|
|
803
834
|
}
|
|
804
835
|
});
|
|
805
836
|
} else {
|
|
@@ -853,7 +884,7 @@ function MapDelegate(config) {
|
|
|
853
884
|
if (knt == 0) {
|
|
854
885
|
ret -= 1;
|
|
855
886
|
}
|
|
856
|
-
}
|
|
887
|
+
}
|
|
857
888
|
return ret;
|
|
858
889
|
}
|
|
859
890
|
function setZoom(filterMeetings, force=0) {
|
|
@@ -866,7 +897,7 @@ function MapDelegate(config) {
|
|
|
866
897
|
return gMainMap.latLngToLayerPoint(L.latLng(lat,lng));
|
|
867
898
|
}
|
|
868
899
|
function createMarker ( inCoords, ///< The long/lat for the marker.
|
|
869
|
-
multi, ///<
|
|
900
|
+
multi, ///< Flag if marker has multiple meetings
|
|
870
901
|
in_html, ///< The info window HTML
|
|
871
902
|
in_title, ///< The tooltip
|
|
872
903
|
in_ids
|
|
@@ -881,10 +912,10 @@ function MapDelegate(config) {
|
|
|
881
912
|
if (typeof crouton != 'undefined') crouton.dayTabFromId(id);
|
|
882
913
|
}
|
|
883
914
|
var marker = L.marker(inCoords, {icon: in_main_icon, title: in_title}).bindPopup(in_html);
|
|
915
|
+
marker.isMulti = multi;
|
|
884
916
|
if (gClusterLayer) gClusterLayer.addLayer(marker);
|
|
885
917
|
else marker.addTo(gMainMap);
|
|
886
918
|
marker.on('popupopen', function(e) {
|
|
887
|
-
marker.oldIcon = marker.getIcon();
|
|
888
919
|
marker.setIcon(g_icon_image_selected);
|
|
889
920
|
gMainMap.on('zoomstart',function(){
|
|
890
921
|
marker.closePopup();
|
|
@@ -897,7 +928,7 @@ function MapDelegate(config) {
|
|
|
897
928
|
});
|
|
898
929
|
});
|
|
899
930
|
marker.on('popupclose', function(e) {
|
|
900
|
-
marker.setIcon(marker.
|
|
931
|
+
marker.setIcon(marker.isMulti ? g_icon_image_multi : g_icon_image_single);
|
|
901
932
|
jQuery(".bmlt-data-row > td").removeClass("rowHighlight");
|
|
902
933
|
});
|
|
903
934
|
gAllMarkers.push( {ids: in_ids, marker: marker} );
|
|
@@ -1025,7 +1056,7 @@ function addControl(div,pos,cb) {
|
|
|
1025
1056
|
gMainMap.on('moveend', function(ev) {
|
|
1026
1057
|
gMainMap.off('moveend');
|
|
1027
1058
|
gMainMap.setZoom(getZoomAdjust(true, filterMeetings));
|
|
1028
|
-
gMainMap.
|
|
1059
|
+
gMainMap.once('moveend',function() {
|
|
1029
1060
|
gTileLayer.redraw();
|
|
1030
1061
|
});
|
|
1031
1062
|
});
|
|
@@ -1093,9 +1124,13 @@ function addControl(div,pos,cb) {
|
|
|
1093
1124
|
function modalOff() {
|
|
1094
1125
|
if (gMainMap) gMainMap.dragging.enable()
|
|
1095
1126
|
}
|
|
1127
|
+
function afterInit(f) {
|
|
1128
|
+
f();
|
|
1129
|
+
}
|
|
1096
1130
|
function returnTrue() {return true;}
|
|
1097
1131
|
this.createMap = createMap;
|
|
1098
1132
|
this.addListener = addListener;
|
|
1133
|
+
this.removeListener = removeListener;
|
|
1099
1134
|
this.addControl = addControl;
|
|
1100
1135
|
this.setViewToPosition = setViewToPosition;
|
|
1101
1136
|
this.clearAllMarkers = clearAllMarkers;
|
|
@@ -1118,9 +1153,11 @@ function addControl(div,pos,cb) {
|
|
|
1118
1153
|
this.getGeocodeCenter = getGeocodeCenter;
|
|
1119
1154
|
this.modalOn = modalOn;
|
|
1120
1155
|
this.modalOff = modalOff;
|
|
1156
|
+
this.afterInit = afterInit;
|
|
1121
1157
|
}
|
|
1122
1158
|
MapDelegate.prototype.createMap = null;
|
|
1123
1159
|
MapDelegate.prototype.addListener = null;
|
|
1160
|
+
MapDelegate.prototype.removeListener = null;
|
|
1124
1161
|
MapDelegate.prototype.addControl = null;
|
|
1125
1162
|
MapDelegate.prototype.setViewToPosition = null;
|
|
1126
1163
|
MapDelegate.prototype.clearAllMarkers = null;
|
|
@@ -1143,6 +1180,7 @@ MapDelegate.prototype.clickSearch = null;
|
|
|
1143
1180
|
MapDelegate.prototype.getGeocodeCenter = null;
|
|
1144
1181
|
MapDelegate.prototype.modalOn = null;
|
|
1145
1182
|
MapDelegate.prototype.modalOff = null;
|
|
1183
|
+
MapDelegate.prototype.afterInit = null;
|
|
1146
1184
|
|
|
1147
1185
|
/* @preserve
|
|
1148
1186
|
* Leaflet 1.5.1+Detached: 2e3e0ffbe87f246eb76d86d2633ddd59b262830b.2e3e0ff, a JS library for interactive maps. http://leafletjs.com
|