Sha256: 825ad744009ecc8dbd5784d4fc0590da1072236ddc3f30c9ab3bf8bfd2fbaddd

Contents?: true

Size: 1.5 KB

Versions: 12

Compression:

Stored size: 1.5 KB

Contents

//= require leaflet-src
//= require Leaflet.fullscreen
//= require native.history
//= require_tree ./templates

!function(global) {
  'use strict';

  /**
   * Convert bounding box string to Leaflet LatLngBounds.
   * @param {String} bbox Space-separated string of sw-lng sw-lat ne-lng ne-lat
   * @return {L.LatLngBounds} Converted Leaflet LatLngBounds object
   */
  L.bboxToBounds = function(bbox) {
    bbox = bbox.split(' ');
    if (bbox.length === 4) {
      return L.latLngBounds([[bbox[1], bbox[0]], [bbox[3], bbox[2]]]);
    } else {
      throw "Invalid bounding box string";
    }
  };

  /**
   * Convert GeoJSON string to Leaflet LatLngBounds.
   * @param {String} geojson GeoJSON string
   * @return {L.LatLngBounds} Converted Leaflet LatLngBounds object
   */
  L.geoJSONToBounds = function(geojson) {
    var layer = L.geoJSON();
    layer.addData(geojson);
    return layer.getBounds();
  }

  var GeoBlacklight = L.Class.extend({
    statics: {
      __version__: '2.0.0',

      debounce: function(fn, delay) {
        var timeout = null;
        return function() {
          var args = arguments, _this = this;
          clearTimeout(timeout);
          timeout = setTimeout(function() {
            fn.apply(_this, args);
          }, delay);
        };
      }
    }
  });

  // Hash for leaflet controls.
  GeoBlacklight.Controls = {};

  // Basic support of CommonJS module
  if (typeof exports === "object") {
    module.exports = GeoBlacklight;
  }

  global.GeoBlacklight = GeoBlacklight;
}(this || {});

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
geoblacklight-4.4.2 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.4.1 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.4.0 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.4.0.rc1 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.3.0 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.2.0 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.1.1 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.1.0 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.0.0 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.0.0.pre.rc3 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.0.0.pre.rc2 app/assets/javascripts/geoblacklight/geoblacklight.js
geoblacklight-4.0.0.pre.rc1 app/assets/javascripts/geoblacklight/geoblacklight.js