|
@@ -1,3 +1,6 @@
|
|
|
+var _markers = {};
|
|
|
+var _mymap = null;
|
|
|
+
|
|
|
function stopLinkext() {
|
|
|
$('a.linkext').on('click', function(e) {
|
|
|
e.preventDefault;
|
|
@@ -7,12 +10,12 @@ function stopLinkext() {
|
|
|
|
|
|
// Streetmap
|
|
|
function map(h_parts, markerObj) {
|
|
|
- var mymap = L.map('mapid').setView([48.9367935,2.3569287], 17);
|
|
|
- setTimeout(mymap.invalidateSize.bind(map));
|
|
|
+ _mymap = L.map('mapid').setView([48.9367935,2.3569287], 17);
|
|
|
+ setTimeout(_mymap.invalidateSize.bind(map));
|
|
|
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
|
|
|
maxZoom: 18,
|
|
|
id: 'mapbox.streets'
|
|
|
- }).addTo(mymap);
|
|
|
+ }).addTo(_mymap);
|
|
|
|
|
|
var LeafIcon = L.Icon.extend({
|
|
|
options: {
|
|
@@ -21,7 +24,7 @@ function map(h_parts, markerObj) {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- var markers = {};
|
|
|
+ // var markers = {};
|
|
|
var greenIcon = new LeafIcon({iconUrl: 'user/themes/r2c/images/pointeur2.svg'})
|
|
|
var id, targets;
|
|
|
for (var i = 0; i < dyn_data.mappoints.length; i++) {
|
|
@@ -29,7 +32,7 @@ function map(h_parts, markerObj) {
|
|
|
|
|
|
targets2 = typeof dyn_data.mappoints[i].target != 'undefined' ? dyn_data.mappoints[i].target.split(',') : [];
|
|
|
|
|
|
- markers[id] = L.marker([dyn_data.mappoints[i].lat, dyn_data.mappoints[i].long], {
|
|
|
+ _markers[id] = L.marker([dyn_data.mappoints[i].lat, dyn_data.mappoints[i].long], {
|
|
|
icon: greenIcon,
|
|
|
targets:targets2
|
|
|
})
|
|
@@ -41,30 +44,34 @@ function map(h_parts, markerObj) {
|
|
|
synchBloks(this.options.targets);
|
|
|
})
|
|
|
.bindPopup(dyn_data.mappoints[i].title)
|
|
|
- .addTo(mymap);
|
|
|
- markers[id]._icon.id = id;
|
|
|
+ .addTo(_mymap);
|
|
|
+ _markers[id]._icon.id = id;
|
|
|
var cible = dyn_data.mappoints[i].target;
|
|
|
- markerObj = markers[id];
|
|
|
- console.log('markerObj',markerObj);
|
|
|
+ markerObj = _markers[id];
|
|
|
+ // console.log('markerObj',markerObj);
|
|
|
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-function markerFunction(markers, h_parts){
|
|
|
- var target = $('#streetmap.mCustomScrollbar');
|
|
|
- var href = target.find(markers);
|
|
|
- console.log('marker', markers);
|
|
|
- console.log('h_parts', h_parts);
|
|
|
+function markerFunction(id){
|
|
|
+ console.log("markerFunction", id);
|
|
|
+ console.log("marker", _markers[id]);
|
|
|
+ _mymap.panTo(_markers[id].openPopup().getLatLng());
|
|
|
+
|
|
|
+ // var target = $('#streetmap.mCustomScrollbar');
|
|
|
+ // var href = target.find(markers);
|
|
|
+ // console.log('marker', markers);
|
|
|
+ // console.log('h_parts', h_parts);
|
|
|
// console.log('href',href);
|
|
|
// console.log('target',target);
|
|
|
// var href = target.find(h_parts[0]);
|
|
|
- h_part1 = h_parts[0];
|
|
|
- for (var i in markers){
|
|
|
- if (markers == h_part1 ) {
|
|
|
- console.log('true');
|
|
|
- // markerV.openPopup(); //marche pas
|
|
|
- }
|
|
|
- }
|
|
|
+ // h_part1 = h_parts[0];
|
|
|
+ // for (var i in markers){
|
|
|
+ // if (markers == h_part1 ) {
|
|
|
+ // console.log('true');
|
|
|
+ // // markerV.openPopup(); //marche pas
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
// change mouse_event
|
|
@@ -369,8 +376,8 @@ function synchBloks(targets, h_parts) {
|
|
|
h_parts = h.match(/^#(([^_]+)_(.+)$)/);
|
|
|
switch (h_parts[2]) {
|
|
|
case 'rct':
|
|
|
- scrollBlockTo($('#recits.mCustomScrollbar'), h);
|
|
|
- break;
|
|
|
+ scrollBlockTo($('#recits.mCustomScrollbar'), h);
|
|
|
+ break;
|
|
|
case 'int':
|
|
|
scrollBlockTo($('#interviews.mCustomScrollbar'), h);
|
|
|
break;
|
|
@@ -379,7 +386,8 @@ function synchBloks(targets, h_parts) {
|
|
|
break;
|
|
|
case 'mp':
|
|
|
scrollBlockTo($('#streetmap.mCustomScrollbar'), h);
|
|
|
- markerFunction(h, h_parts);
|
|
|
+ console.log('h_parts', h_parts);
|
|
|
+ markerFunction(h_parts[1]);
|
|
|
break;
|
|
|
case 'lk':
|
|
|
scrollBlockTo($('#links.mCustomScrollbar'), h);
|