@@ -354,26 +354,6 @@ if (typeof Extras == "undefined" || !Extras)
354
354
*/
355
355
Extras . DocumentListGeoViewRenderer . prototype . _renderMap = function DL_GVR__renderMap ( scope , mapId , pObj )
356
356
{
357
- /*
358
- // set up the map
359
- var center = pObj.center,
360
- map = new L.Map(mapId).setView([center.lat, center.lng], this.zoomLevel);
361
-
362
- // create the tile layer with correct attribution
363
- L.tileLayer(this.options.leafletTileUrl, {
364
- attribution: scope.msg("label.copyright.osm")
365
- }).addTo(map);
366
-
367
- map.on('zoomend', function(e) {
368
- this._saveMapPreferences.call(this, scope);
369
- }, this);
370
-
371
- map.on('moveend', function(e) {
372
- this._saveMapPreferences.call(this, scope);
373
- }, this);
374
-
375
- this.map = map;
376
- */
377
357
var me = this ,
378
358
center = pObj . center ;
379
359
var myLatlng = new google . maps . LatLng ( center . lat , center . lng ) ;
@@ -405,14 +385,6 @@ if (typeof Extras == "undefined" || !Extras)
405
385
*/
406
386
Extras . DocumentListGeoViewRenderer . prototype . _addMarker = function DL_GVR__addMarker ( mObj )
407
387
{
408
- /*
409
- var marker = L.marker([mObj.lat, mObj.lng], {
410
- title: mObj.title
411
- }).addTo(this.map);
412
- marker.bindPopup(Dom.get(mObj.galleryItemDetailDivId), { width: 400, maxWidth: 400 });
413
- Alfresco.logger.debug("Binding popup to item ID " + mObj.galleryItemDetailDivId);
414
- this.markers.push(marker);
415
- */
416
388
var me = this , map = this . map ;
417
389
var latLng = new google . maps . LatLng ( mObj . lat , mObj . lng ) ;
418
390
var marker = new google . maps . Marker (
@@ -443,7 +415,6 @@ if (typeof Extras == "undefined" || !Extras)
443
415
{
444
416
for ( var i = 0 ; i < this . markers . length ; i ++ )
445
417
{
446
- //this.map.removeLayer(this.markers[i]);
447
418
this . markers [ i ] . setMap ( null ) ;
448
419
}
449
420
}
@@ -457,18 +428,6 @@ if (typeof Extras == "undefined" || !Extras)
457
428
*/
458
429
Extras . DocumentListGeoViewRenderer . prototype . _saveMapPreferences = function DL_GVR__saveMapPreferences ( scope )
459
430
{
460
- /*
461
- // save map position and zoom levels
462
- // when zooming leaflet fires both events, which leads to an exception being thrown from the repo
463
- // therefore we must first check that the another event is not 'in progress' before attempting the save
464
- this._savePreferenceValues(scope, {
465
- zoom: this.map.getZoom(),
466
- center: {
467
- lat: this.map.getCenter().lat,
468
- lng: this.map.getCenter().lng
469
- }
470
- });
471
- */
472
431
this . _savePreferenceValues ( scope , {
473
432
zoom : this . map . getZoom ( ) ,
474
433
center : {
@@ -530,5 +489,62 @@ if (typeof Extras == "undefined" || !Extras)
530
489
{
531
490
YAHOO . Bubbling . fire ( "gmapsScriptLoaded" ) ;
532
491
}
492
+
493
+ YAHOO . extend ( Extras . DocumentListLeafletGeoViewRenderer , Extras . DocumentListGeoViewRenderer ,
494
+ {
495
+ _renderMap : function DL_LGVR__renderMap ( scope , mapId , pObj )
496
+ {
497
+ // set up the map
498
+ var center = pObj . center ,
499
+ map = new L . Map ( mapId ) . setView ( [ center . lat , center . lng ] , this . zoomLevel ) ;
500
+
501
+ // create the tile layer with correct attribution
502
+ L . tileLayer ( this . options . leafletTileUrl , {
503
+ attribution : scope . msg ( "label.copyright.osm" )
504
+ } ) . addTo ( map ) ;
505
+
506
+ map . on ( 'zoomend' , function ( e ) {
507
+ this . _saveMapPreferences . call ( this , scope ) ;
508
+ } , this ) ;
509
+
510
+ map . on ( 'moveend' , function ( e ) {
511
+ this . _saveMapPreferences . call ( this , scope ) ;
512
+ } , this ) ;
513
+
514
+ this . map = map ;
515
+ } ,
516
+
517
+ _addMarker : function DL_LGVR__addMarker ( mObj )
518
+ {
519
+ var marker = L . marker ( [ mObj . lat , mObj . lng ] , {
520
+ title : mObj . title
521
+ } ) . addTo ( this . map ) ;
522
+ marker . bindPopup ( Dom . get ( mObj . galleryItemDetailDivId ) , { width : 400 , maxWidth : 400 } ) ;
523
+ Alfresco . logger . debug ( "Binding popup to item ID " + mObj . galleryItemDetailDivId ) ;
524
+ this . markers . push ( marker ) ;
525
+ } ,
526
+
527
+ _removeAllMarkers : function DL_GVR__removeAllMarkers ( )
528
+ {
529
+ for ( var i = 0 ; i < this . markers . length ; i ++ )
530
+ {
531
+ this . map . removeLayer ( this . markers [ i ] ) ;
532
+ }
533
+ } ,
534
+
535
+ _saveMapPreferences = function DL_LGVR__saveMapPreferences ( scope )
536
+ {
537
+ // save map position and zoom levels
538
+ // when zooming leaflet fires both events, which leads to an exception being thrown from the repo
539
+ // therefore we must first check that the another event is not 'in progress' before attempting the save
540
+ this . _savePreferenceValues ( scope , {
541
+ zoom : this . map . getZoom ( ) ,
542
+ center : {
543
+ lat : this . map . getCenter ( ) . lat ,
544
+ lng : this . map . getCenter ( ) . lng
545
+ }
546
+ } ) ;
547
+ }
548
+ } ) ;
533
549
534
550
} ) ( ) ;
0 commit comments