tests/Leaflet/sl-application.js
/**
 * Creates a Second Life map in the given DOM element & returns the Leaflet Map.
 *
 * @param {Element} map_element the DOM element to contain the map
 */
Creates a Second Life map in the given DOM element & returns the Leaflet Map.
@param {Element} map_element the DOM element to contain the map
Creates a Second Life map in the given DOM element & returns the Leaflet Map . @param { Element } map_element the DOM element to contain the map
function SLMap(mapElement, mapOptions)
{
    mapElement.className += ' slmapapi2-map-container';
    var mapDiv = document.createElement("div");
    mapDiv.style.height = "100%";
    mapElement.appendChild(mapDiv);
    var SLTileLayer = L.TileLayer.extend({
        getTileUrl: function (coords) {
            var data = {
                r: L.Browser.retina ? '@2x' : '',
                s: this._getSubdomain(coords),
                z: this._getZoomForUrl()
            };
            var regionsPerTileEdge = Math.pow(2, data['z'] - 1);
            data['region_x'] = coords.x * regionsPerTileEdge;
            data['region_y'] = (Math.abs(coords.y) - 1) * regionsPerTileEdge;
            return L.Util.template(this._url, L.extend(data, this.options));
        }
    });
    var tiles = new SLTileLayer($.sl.maps.config.tile_url + "/map-{z}-{region_x}-{region_y}-objects.jpg", {
        crs: L.CRS.Simple,
        minZoom: MIN_ZOOM_LEVEL,
        maxZoom: MAX_ZOOM_LEVEL,
        zoomOffset: 1,
        zoomReverse: true,
        bounds: [[0, 0], [$.sl.maps.config.map_grid_edge_size, $.sl.maps.config.map_grid_edge_size]],
        attribution: "<a href='" + $.sl.maps.config.sl_base_url + "'>Second Life</a>"
    });
    var map = L.map(mapDiv, {
        crs: L.CRS.Simple,
        minZoom: MIN_ZOOM_LEVEL,
        maxZoom: MAX_ZOOM_LEVEL,
        maxBounds: [[0, 0], [$.sl.maps.config.map_grid_edge_size, $.sl.maps.config.map_grid_edge_size]],
        layers: [tiles]
    });
    map.on('click', function (event) {
        gotoSLURL(event.latlng.lng, event.latlng.lat, map);
    });
    return map;
}
function SLMap ( mapElement , mapOptions ) { mapElement . className += ' slmapapi2-map-container' ; var mapDiv = document . createElement ( "div" ) ; mapDiv . style . height = "100%" ; mapElement . appendChild ( mapDiv ) ; var SLTileLayer = L . TileLayer . extend ( { getTileUrl : function ( coords ) { var data = { r : L . Browser . retina ? '@2x' : '' , s : this . _getSubdomain ( coords ) , z : this . _getZoomForUrl ( ) } ; var regionsPerTileEdge = Math . pow ( 2 , data [ 'z' ] - 1 ) ; data [ 'region_x' ] = coords . x * regionsPerTileEdge ; data [ 'region_y' ] = ( Math . abs ( coords . y ) - 1 ) * regionsPerTileEdge ; return L . Util . template ( this . _url , L . extend ( data , this . options ) ) ; } } ) ; var tiles = new SLTileLayer ( $ . sl . maps . config . tile_url + "/map-{z}-{region_x}-{region_y}-objects.jpg" , { crs : L . CRS . Simple , minZoom : MIN_ZOOM_LEVEL , maxZoom : MAX_ZOOM_LEVEL , zoomOffset : 1 , zoomReverse : true , bounds : [ [ 0 , 0 ] , [ $ . sl . maps . config . map_grid_edge_size , $ . sl . maps . config . map_grid_edge_size ] ] , attribution : "<a href='" + $ . sl . maps . config . sl_base_url + "'>Second Life</a>" } ) ; var map = L . map ( mapDiv , { crs : L . CRS . Simple , minZoom : MIN_ZOOM_LEVEL , maxZoom : MAX_ZOOM_LEVEL , maxBounds : [ [ 0 , 0 ] , [ $ . sl . maps . config . map_grid_edge_size , $ . sl . maps . config . map_grid_edge_size ] ] , layers : [ tiles ] } ) ; map . on ( 'click' , function ( event ) { gotoSLURL ( event . latlng . lng , event . latlng . lat , map ) ; } ) ; return map ; }
Creates a Second Life map in the given DOM element & returns the Leaflet Map.
Creates a Second Life map in the given DOM element & returns the Leaflet Map .