Skip to content

Commit

Permalink
Added a few helpful event hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Wolf committed Nov 3, 2016
1 parent 21a467b commit 601614f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions assets/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jQuery( function() {
//console.log( 'config:', config, ' mapID: ', strMapID );

if( typeof( strMapID ) != 'undefined' && strMapID != '' && typeof( config ) == 'object' ) {

// fire custom init event
jQuery( document ).trigger( '_ui_leaflet_map_init' );



Expand All @@ -31,7 +32,9 @@ jQuery( function() {

if( typeof(config.latitude ) != 'undefined' && typeof( config.longitude ) != 'undefined' ) {
var map_zoomlevel = ( typeof( config.zoom ) != 'undefined' ? config.zoom : 16 );
console.log( 'zoomlevel:', map_zoomlevel );

//console.log( 'zoomlevel:', map_zoomlevel );

var map_layer = ( typeof( config.layer ) != 'undefined' ? config.layer : 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' );

// init map
Expand Down Expand Up @@ -93,12 +96,15 @@ jQuery( function() {

L.marker( posMarker, {icon: L.divIcon({className: 'ui-leaflet-div-icon', html: strMarkerIcon} ) } ).addTo( _ui_leaflet_maps[strMapID] ).bindPopup( strMarkerText ).openPopup();

jQuery( document ).trigger( '_ui_leaflet_map_marker_added' );

// .. and remove marker code from dom, to avoid issues
jQuery('#' + strMapID + ' script.ui-leaflet-marker' ).remove();

}
}

jQuery( document ).trigger( '_ui_leaflet_map_loaded' );
}
})
}
Expand Down

0 comments on commit 601614f

Please sign in to comment.