leaflet-js 0.6.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.rdoc +32 -0
- data/LICENSE +21 -0
- data/README.rdoc +54 -0
- data/Rakefile +15 -0
- data/leaflet-js.gemspec +28 -0
- data/lib/leaflet-js.rb +10 -0
- data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
- data/lib/leaflet.draw/CHANGELOG.md +73 -0
- data/lib/leaflet.draw/Jakefile.js +26 -0
- data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.draw/README.md +364 -0
- data/lib/leaflet.draw/TODO.md +62 -0
- data/lib/leaflet.draw/build/build.html +243 -0
- data/lib/leaflet.draw/build/build.js +189 -0
- data/lib/leaflet.draw/build/deps.js +75 -0
- data/lib/leaflet.draw/build/hintrc.js +47 -0
- data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
- data/lib/leaflet.draw/dist/images/spritesheet.png +0 -0
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +2429 -0
- data/lib/leaflet.draw/dist/leaflet.draw.css +212 -0
- data/lib/leaflet.draw/dist/leaflet.draw.ie.css +44 -0
- data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
- data/lib/leaflet.draw/examples/basic.html +106 -0
- data/lib/leaflet.draw/examples/edithandlers.html +67 -0
- data/lib/leaflet.draw/examples/libs/images/layers.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-shadow.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +8587 -0
- data/lib/leaflet.draw/examples/libs/leaflet.css +459 -0
- data/lib/leaflet.draw/examples/libs/leaflet.ie.css +51 -0
- data/lib/leaflet.draw/package.json +37 -0
- data/lib/leaflet.draw/spec/after.js +2 -0
- data/lib/leaflet.draw/spec/before.js +3 -0
- data/lib/leaflet.draw/spec/expect.js +1253 -0
- data/lib/leaflet.draw/spec/happen.js +93 -0
- data/lib/leaflet.draw/spec/index.html +36 -0
- data/lib/leaflet.draw/spec/karma.conf.js +69 -0
- data/lib/leaflet.draw/spec/sinon.js +4223 -0
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +15 -0
- data/lib/leaflet.draw/spec/suites/SpecHelper.js +26 -0
- data/lib/leaflet.draw/src/Control.Draw.js +101 -0
- data/lib/leaflet.draw/src/Leaflet.draw.js +5 -0
- data/lib/leaflet.draw/src/Toolbar.js +187 -0
- data/lib/leaflet.draw/src/Tooltip.js +52 -0
- data/lib/leaflet.draw/src/copyright.js +8 -0
- data/lib/leaflet.draw/src/draw/DrawToolbar.js +107 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Circle.js +59 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Feature.js +74 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Marker.js +97 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Polygon.js +79 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Polyline.js +360 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.Rectangle.js +41 -0
- data/lib/leaflet.draw/src/draw/handler/Draw.SimpleShape.js +67 -0
- data/lib/leaflet.draw/src/edit/EditToolbar.js +93 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Circle.js +63 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Poly.js +267 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.Rectangle.js +117 -0
- data/lib/leaflet.draw/src/edit/handler/Edit.SimpleShape.js +138 -0
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Delete.js +109 -0
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Edit.js +233 -0
- data/lib/leaflet.draw/src/ext/LatLngUtil.js +18 -0
- data/lib/leaflet.draw/src/ext/LineUtil.Intersect.js +15 -0
- data/lib/leaflet.draw/src/ext/Polygon.Intersect.js +27 -0
- data/lib/leaflet.draw/src/ext/Polyline.Intersect.js +85 -0
- data/lib/leaflet.label/CHANGELOG.md +35 -0
- data/lib/leaflet.label/Jakefile.js +21 -0
- data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.label/README.md +86 -0
- data/lib/leaflet.label/build/build.js +155 -0
- data/lib/leaflet.label/build/deps.js +24 -0
- data/lib/leaflet.label/build/hint.js +30 -0
- data/lib/leaflet.label/build/hintrc.js +47 -0
- data/lib/leaflet.label/dist/images/death.png +0 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +359 -0
- data/lib/leaflet.label/dist/leaflet.label.css +33 -0
- data/lib/leaflet.label/dist/leaflet.label.js +9 -0
- data/lib/leaflet.label/example/label.html +82 -0
- data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
- data/lib/leaflet.label/libs/leaflet/leaflet-src.js +8587 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.css +459 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.ie.css +51 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.js +8 -0
- data/lib/leaflet.label/src/FeatureGroup.Label.js +20 -0
- data/lib/leaflet.label/src/Label.js +123 -0
- data/lib/leaflet.label/src/Leaflet.label.js +5 -0
- data/lib/leaflet.label/src/Map.Label.js +7 -0
- data/lib/leaflet.label/src/Marker.Label.js +160 -0
- data/lib/leaflet.label/src/Path.Label.js +55 -0
- data/lib/leaflet.label/src/copyright.js +8 -0
- data/lib/leaflet/CHANGELOG.md +637 -0
- data/lib/leaflet/CONTRIBUTING.md +155 -0
- data/lib/leaflet/Jakefile.js +26 -0
- data/lib/leaflet/LICENSE +23 -0
- data/lib/leaflet/README.md +30 -0
- data/lib/leaflet/build/build.html +243 -0
- data/lib/leaflet/build/build.js +193 -0
- data/lib/leaflet/build/deps.js +256 -0
- data/lib/leaflet/build/hintrc.js +37 -0
- data/lib/leaflet/debug/css/mobile.css +6 -0
- data/lib/leaflet/debug/css/screen.css +5 -0
- data/lib/leaflet/debug/hacks/jitter.html +43 -0
- data/lib/leaflet/debug/leaflet-include.js +59 -0
- data/lib/leaflet/debug/map/canvas.html +47 -0
- data/lib/leaflet/debug/map/controls.html +50 -0
- data/lib/leaflet/debug/map/geolocation.html +35 -0
- data/lib/leaflet/debug/map/image-overlay.html +44 -0
- data/lib/leaflet/debug/map/map-mobile.html +35 -0
- data/lib/leaflet/debug/map/map.html +60 -0
- data/lib/leaflet/debug/map/max-bounds.html +37 -0
- data/lib/leaflet/debug/map/scroll.html +36 -0
- data/lib/leaflet/debug/map/simple-proj.html +45 -0
- data/lib/leaflet/debug/map/wms-marble.html +31 -0
- data/lib/leaflet/debug/map/wms.html +41 -0
- data/lib/leaflet/debug/map/zoomlevels.html +46 -0
- data/lib/leaflet/debug/tests/add_remove_layers.html +88 -0
- data/lib/leaflet/debug/tests/bringtoback.html +38 -0
- data/lib/leaflet/debug/tests/click_on_canvas.html +59 -0
- data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
- data/lib/leaflet/debug/tests/opacity.html +57 -0
- data/lib/leaflet/debug/tests/remove_while_dragging.html +29 -0
- data/lib/leaflet/debug/tests/removetilewhilepan.html +42 -0
- data/lib/leaflet/debug/tests/reuse_popups.html +41 -0
- data/lib/leaflet/debug/tests/svg_clicks.html +55 -0
- data/lib/leaflet/debug/vector/bounds-extend.html +89 -0
- data/lib/leaflet/debug/vector/feature-group-bounds.html +91 -0
- data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
- data/lib/leaflet/debug/vector/geojson.html +174 -0
- data/lib/leaflet/debug/vector/rectangle.html +54 -0
- data/lib/leaflet/debug/vector/route.js +1 -0
- data/lib/leaflet/debug/vector/touchzoomemu.html +195 -0
- data/lib/leaflet/debug/vector/us-states.js +54 -0
- data/lib/leaflet/debug/vector/vector-bounds.html +70 -0
- data/lib/leaflet/debug/vector/vector-canvas.html +93 -0
- data/lib/leaflet/debug/vector/vector-mobile.html +39 -0
- data/lib/leaflet/debug/vector/vector-simple.html +49 -0
- data/lib/leaflet/debug/vector/vector.html +38 -0
- data/lib/leaflet/dist/images/layers.png +0 -0
- data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
- data/lib/leaflet/dist/images/marker-icon.png +0 -0
- data/lib/leaflet/dist/images/marker-shadow.png +0 -0
- data/lib/leaflet/dist/leaflet-src.js +8579 -0
- data/lib/leaflet/dist/leaflet.css +459 -0
- data/lib/leaflet/dist/leaflet.ie.css +51 -0
- data/lib/leaflet/dist/leaflet.js +8 -0
- data/lib/leaflet/package.json +22 -0
- data/lib/leaflet/spec/after.js +2 -0
- data/lib/leaflet/spec/before.js +3 -0
- data/lib/leaflet/spec/expect.js +1253 -0
- data/lib/leaflet/spec/happen.js +93 -0
- data/lib/leaflet/spec/index.html +78 -0
- data/lib/leaflet/spec/karma.conf.js +64 -0
- data/lib/leaflet/spec/sinon.js +4223 -0
- data/lib/leaflet/spec/suites/LeafletSpec.js +13 -0
- data/lib/leaflet/spec/suites/SpecHelper.js +26 -0
- data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +68 -0
- data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +67 -0
- data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +6 -0
- data/lib/leaflet/spec/suites/core/ClassSpec.js +156 -0
- data/lib/leaflet/spec/suites/core/EventsSpec.js +336 -0
- data/lib/leaflet/spec/suites/core/UtilSpec.js +212 -0
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +89 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +136 -0
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +118 -0
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +47 -0
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +87 -0
- data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +75 -0
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +104 -0
- data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +27 -0
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +31 -0
- data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +36 -0
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +86 -0
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +58 -0
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +59 -0
- data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +87 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +17 -0
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +55 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +55 -0
- data/lib/leaflet/spec/suites/map/MapSpec.js +244 -0
- data/lib/leaflet/src/Leaflet.js +23 -0
- data/lib/leaflet/src/control/Control.Attribution.js +115 -0
- data/lib/leaflet/src/control/Control.Layers.js +243 -0
- data/lib/leaflet/src/control/Control.Scale.js +112 -0
- data/lib/leaflet/src/control/Control.Zoom.js +86 -0
- data/lib/leaflet/src/control/Control.js +107 -0
- data/lib/leaflet/src/copyright.js +4 -0
- data/lib/leaflet/src/core/Browser.js +96 -0
- data/lib/leaflet/src/core/Class.js +106 -0
- data/lib/leaflet/src/core/Events.js +174 -0
- data/lib/leaflet/src/core/Handler.js +28 -0
- data/lib/leaflet/src/core/Util.js +182 -0
- data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +103 -0
- data/lib/leaflet/src/dom/DomEvent.MsTouch.js +146 -0
- data/lib/leaflet/src/dom/DomEvent.js +211 -0
- data/lib/leaflet/src/dom/DomUtil.js +239 -0
- data/lib/leaflet/src/dom/Draggable.js +198 -0
- data/lib/leaflet/src/dom/PosAnimation.Timer.js +67 -0
- data/lib/leaflet/src/dom/PosAnimation.js +83 -0
- data/lib/leaflet/src/geo/LatLng.js +88 -0
- data/lib/leaflet/src/geo/LatLngBounds.js +153 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +14 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +21 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG4326.js +10 -0
- data/lib/leaflet/src/geo/crs/CRS.Simple.js +12 -0
- data/lib/leaflet/src/geo/crs/CRS.js +27 -0
- data/lib/leaflet/src/geo/projection/Projection.LonLat.js +13 -0
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +56 -0
- data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +27 -0
- data/lib/leaflet/src/geo/projection/Projection.js +5 -0
- data/lib/leaflet/src/geometry/Bounds.js +95 -0
- data/lib/leaflet/src/geometry/LineUtil.js +202 -0
- data/lib/leaflet/src/geometry/Point.js +119 -0
- data/lib/leaflet/src/geometry/PolyUtil.js +55 -0
- data/lib/leaflet/src/geometry/Transformation.js +31 -0
- data/lib/leaflet/src/images/marker.svg +1 -0
- data/lib/leaflet/src/layer/FeatureGroup.js +81 -0
- data/lib/leaflet/src/layer/GeoJSON.js +245 -0
- data/lib/leaflet/src/layer/ImageOverlay.js +132 -0
- data/lib/leaflet/src/layer/LayerGroup.js +110 -0
- data/lib/leaflet/src/layer/Popup.js +316 -0
- data/lib/leaflet/src/layer/marker/DivIcon.js +43 -0
- data/lib/leaflet/src/layer/marker/Icon.Default.js +51 -0
- data/lib/leaflet/src/layer/marker/Icon.js +101 -0
- data/lib/leaflet/src/layer/marker/Marker.Drag.js +66 -0
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +72 -0
- data/lib/leaflet/src/layer/marker/Marker.js +275 -0
- data/lib/leaflet/src/layer/tile/TileLayer.Anim.js +117 -0
- data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +60 -0
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +83 -0
- data/lib/leaflet/src/layer/tile/TileLayer.js +578 -0
- data/lib/leaflet/src/layer/vector/Circle.js +98 -0
- data/lib/leaflet/src/layer/vector/CircleMarker.js +33 -0
- data/lib/leaflet/src/layer/vector/MultiPoly.js +47 -0
- data/lib/leaflet/src/layer/vector/Path.Popup.js +65 -0
- data/lib/leaflet/src/layer/vector/Path.SVG.js +219 -0
- data/lib/leaflet/src/layer/vector/Path.VML.js +125 -0
- data/lib/leaflet/src/layer/vector/Path.js +115 -0
- data/lib/leaflet/src/layer/vector/Polygon.js +81 -0
- data/lib/leaflet/src/layer/vector/Polyline.js +164 -0
- data/lib/leaflet/src/layer/vector/Rectangle.js +27 -0
- data/lib/leaflet/src/layer/vector/canvas/Circle.Canvas.js +18 -0
- data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +196 -0
- data/lib/leaflet/src/layer/vector/canvas/Polygon.Canvas.js +37 -0
- data/lib/leaflet/src/layer/vector/canvas/Polyline.Canvas.js +30 -0
- data/lib/leaflet/src/map/Map.js +743 -0
- data/lib/leaflet/src/map/anim/Map.PanAnimation.js +88 -0
- data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +90 -0
- data/lib/leaflet/src/map/ext/Map.Geolocation.js +91 -0
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +104 -0
- data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +23 -0
- data/lib/leaflet/src/map/handler/Map.Drag.js +146 -0
- data/lib/leaflet/src/map/handler/Map.Keyboard.js +147 -0
- data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +56 -0
- data/lib/leaflet/src/map/handler/Map.TouchZoom.js +121 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/images/spritesheet.png +0 -0
- data/vendor/assets/javascripts/leaflet.draw.js +39 -0
- data/vendor/assets/javascripts/leaflet.js +145 -0
- data/vendor/assets/javascripts/leaflet.label.js +9 -0
- data/vendor/assets/stylesheets/leaflet.css.erb +459 -0
- data/vendor/assets/stylesheets/leaflet.draw.css.erb +212 -0
- data/vendor/assets/stylesheets/leaflet.draw.ie.css +44 -0
- data/vendor/assets/stylesheets/leaflet.ie.css +51 -0
- data/vendor/assets/stylesheets/leaflet.label.css +33 -0
- metadata +317 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
/*
|
2
|
+
* L.PolyUtil contains utility functions for polygons (clipping, etc.).
|
3
|
+
*/
|
4
|
+
|
5
|
+
/*jshint bitwise:false */ // allow bitwise operations here
|
6
|
+
|
7
|
+
L.PolyUtil = {};
|
8
|
+
|
9
|
+
/*
|
10
|
+
* Sutherland-Hodgeman polygon clipping algorithm.
|
11
|
+
* Used to avoid rendering parts of a polygon that are not currently visible.
|
12
|
+
*/
|
13
|
+
L.PolyUtil.clipPolygon = function (points, bounds) {
|
14
|
+
var clippedPoints,
|
15
|
+
edges = [1, 4, 2, 8],
|
16
|
+
i, j, k,
|
17
|
+
a, b,
|
18
|
+
len, edge, p,
|
19
|
+
lu = L.LineUtil;
|
20
|
+
|
21
|
+
for (i = 0, len = points.length; i < len; i++) {
|
22
|
+
points[i]._code = lu._getBitCode(points[i], bounds);
|
23
|
+
}
|
24
|
+
|
25
|
+
// for each edge (left, bottom, right, top)
|
26
|
+
for (k = 0; k < 4; k++) {
|
27
|
+
edge = edges[k];
|
28
|
+
clippedPoints = [];
|
29
|
+
|
30
|
+
for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {
|
31
|
+
a = points[i];
|
32
|
+
b = points[j];
|
33
|
+
|
34
|
+
// if a is inside the clip window
|
35
|
+
if (!(a._code & edge)) {
|
36
|
+
// if b is outside the clip window (a->b goes out of screen)
|
37
|
+
if (b._code & edge) {
|
38
|
+
p = lu._getEdgeIntersection(b, a, edge, bounds);
|
39
|
+
p._code = lu._getBitCode(p, bounds);
|
40
|
+
clippedPoints.push(p);
|
41
|
+
}
|
42
|
+
clippedPoints.push(a);
|
43
|
+
|
44
|
+
// else if b is inside the clip window (a->b enters the screen)
|
45
|
+
} else if (!(b._code & edge)) {
|
46
|
+
p = lu._getEdgeIntersection(b, a, edge, bounds);
|
47
|
+
p._code = lu._getBitCode(p, bounds);
|
48
|
+
clippedPoints.push(p);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
points = clippedPoints;
|
52
|
+
}
|
53
|
+
|
54
|
+
return points;
|
55
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/*
|
2
|
+
* L.Transformation is an utility class to perform simple point transformations through a 2d-matrix.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Transformation = function (a, b, c, d) {
|
6
|
+
this._a = a;
|
7
|
+
this._b = b;
|
8
|
+
this._c = c;
|
9
|
+
this._d = d;
|
10
|
+
};
|
11
|
+
|
12
|
+
L.Transformation.prototype = {
|
13
|
+
transform: function (point, scale) { // (Point, Number) -> Point
|
14
|
+
return this._transform(point.clone(), scale);
|
15
|
+
},
|
16
|
+
|
17
|
+
// destructive transform (faster)
|
18
|
+
_transform: function (point, scale) {
|
19
|
+
scale = scale || 1;
|
20
|
+
point.x = scale * (this._a * point.x + this._b);
|
21
|
+
point.y = scale * (this._c * point.y + this._d);
|
22
|
+
return point;
|
23
|
+
},
|
24
|
+
|
25
|
+
untransform: function (point, scale) {
|
26
|
+
scale = scale || 1;
|
27
|
+
return new L.Point(
|
28
|
+
(point.x / scale - this._b) / this._a,
|
29
|
+
(point.y / scale - this._d) / this._c);
|
30
|
+
}
|
31
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="744.094" height="1052.362"><defs><linearGradient id="b"><stop offset="0" stop-color="#2e6c97"/><stop offset="1" stop-color="#3883b7"/></linearGradient><linearGradient id="a"><stop offset="0" stop-color="#126fc6"/><stop offset="1" stop-color="#4c9cd1"/></linearGradient><linearGradient xlink:href="#a" x1="351.138" y1="551.589" x2="351.138" y2="512.928" gradientUnits="userSpaceOnUse" gradientTransform="translate(-2.715)"/><linearGradient xlink:href="#a" x1="318.571" y1="550.052" x2="318.571" y2="512.422" gradientUnits="userSpaceOnUse" gradientTransform="translate(94.732 2.054)"/><linearGradient xlink:href="#a" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1 0 0 1 731.268 2.054)" x1="318.571" y1="550.052" x2="318.571" y2="512.422"/><linearGradient xlink:href="#a" gradientUnits="userSpaceOnUse" gradientTransform="translate(94.232 2.054)" x1="318.571" y1="550.052" x2="318.571" y2="512.422"/><linearGradient xlink:href="#a" gradientUnits="userSpaceOnUse" gradientTransform="translate(-28.58 -.437)" x1="445.301" y1="541.286" x2="445.301" y2="503.72"/><linearGradient xlink:href="#b" gradientUnits="userSpaceOnUse" gradientTransform="translate(63 -.438)" x1="351.748" y1="522.774" x2="351.748" y2="503.721"/><linearGradient xlink:href="#a" gradientUnits="userSpaceOnUse" gradientTransform="translate(-28.58 -.437)" x1="445.301" y1="541.286" x2="445.301" y2="503.72"/><linearGradient xlink:href="#b" gradientUnits="userSpaceOnUse" gradientTransform="translate(63 -.438)" x1="351.748" y1="522.774" x2="351.748" y2="503.721"/><linearGradient xlink:href="#a" gradientUnits="userSpaceOnUse" gradientTransform="translate(-28.58 -.437)" x1="445.301" y1="541.286" x2="445.301" y2="503.72"/><linearGradient xlink:href="#b" gradientUnits="userSpaceOnUse" gradientTransform="translate(63 -.438)" x1="351.748" y1="522.774" x2="351.748" y2="503.721"/><linearGradient xlink:href="#a" id="c" gradientUnits="userSpaceOnUse" gradientTransform="translate(-28.846 -.287)" x1="445.301" y1="541.286" x2="445.301" y2="503.72"/><linearGradient xlink:href="#b" id="d" gradientUnits="userSpaceOnUse" gradientTransform="translate(62.734 -.288)" x1="351.748" y1="522.774" x2="351.748" y2="503.721"/><linearGradient xlink:href="#a" gradientUnits="userSpaceOnUse" gradientTransform="translate(-28.846 -.287)" x1="445.301" y1="541.286" x2="445.301" y2="503.72"/><linearGradient xlink:href="#b" gradientUnits="userSpaceOnUse" gradientTransform="translate(62.734 -.288)" x1="351.748" y1="522.774" x2="351.748" y2="503.721"/></defs><g><image y="502.237" x="369.375" xlink:href="data:image/png;base64,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 0YvhJSIAAAAASUVORK5CYII=" height="41" width="25"/><rect y="507.575" x="410.279" height="14.5" width="12.625" fill="#fff"/><path d="m416.544 503.612c-6.573 0-12.044 5.691-12.044 11.866 0 2.778 1.564 6.308 2.694 8.746l9.306 17.872 9.262-17.872c1.13-2.438 2.738-5.791 2.738-8.746 0-6.175-5.383-11.866-11.956-11.866zm0 7.155c2.584.017 4.679 2.122 4.679 4.71s-2.095 4.663-4.679 4.679c-2.584-.017-4.679-2.09-4.679-4.679 0-2.588 2.095-4.693 4.679-4.71z" fill="url(#c)" stroke="url(#d)" stroke-width="1.1" stroke-linecap="round"/><text style="line-height:125%" x="403.75" y="489.362" font-size="4" letter-spacing="0" word-spacing="0" font-family="Sans"><tspan x="403.75" y="489.362">Use this one.</tspan><tspan x="403.75" y="494.362">Select it and the area around with box select.</tspan><tspan x="403.75" y="499.362">should be exactly 25x41 at 90dpi</tspan></text><text style="line-height:125%" x="408.708" y="563.751" font-size="40" letter-spacing="0" word-spacing="0" font-family="Sans"><tspan x="408.708" y="563.751" font-size="4">How to do the inset border:</tspan><tspan x="408.708" y="568.751" font-size="4">Delete the existing inset border. Select the background, duplicate.</tspan><tspan x="408.708" y="573.751" font-size="4">Path, Dynamic offset.</tspan><tspan x="408.708" y="578.751" font-size="4">Fill: None, Stroke Paint: RGBA #ffffff1f</tspan><tspan x="408.708" y="583.751" font-size="4">Zoom down to the top and grab the diamond, drag it down and fiddle it untill it looks in line</tspan><tspan x="408.708" y="588.751" font-size="4">with the main color layers border.</tspan></text><path d="m416.531 504.719c-5.944 0-10.938 5.219-10.938 10.75 0 2.359 1.443 5.832 2.563 8.25l.031.031 8.313 15.969 8.25-15.969.031-.031c1.135-2.448 2.625-5.706 2.625-8.25 0-5.538-4.931-10.75-10.875-10.75zm0 4.969c3.168.021 5.781 2.601 5.781 5.781 0 3.18-2.613 5.761-5.781 5.781-3.168-.02-5.75-2.61-5.75-5.781 0-3.172 2.582-5.761 5.75-5.781z" stroke="#fff" stroke-width="1.1" stroke-linecap="round" stroke-opacity=".122" fill="none"/></g></svg>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
* L.FeatureGroup extends L.LayerGroup by introducing mouse events and additional methods
|
3
|
+
* shared between a group of interactive layers (like vectors or markers).
|
4
|
+
*/
|
5
|
+
|
6
|
+
L.FeatureGroup = L.LayerGroup.extend({
|
7
|
+
includes: L.Mixin.Events,
|
8
|
+
|
9
|
+
statics: {
|
10
|
+
EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu'
|
11
|
+
},
|
12
|
+
|
13
|
+
addLayer: function (layer) {
|
14
|
+
if (this.hasLayer(layer)) {
|
15
|
+
return this;
|
16
|
+
}
|
17
|
+
|
18
|
+
layer.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
|
19
|
+
|
20
|
+
L.LayerGroup.prototype.addLayer.call(this, layer);
|
21
|
+
|
22
|
+
if (this._popupContent && layer.bindPopup) {
|
23
|
+
layer.bindPopup(this._popupContent, this._popupOptions);
|
24
|
+
}
|
25
|
+
|
26
|
+
return this.fire('layeradd', {layer: layer});
|
27
|
+
},
|
28
|
+
|
29
|
+
removeLayer: function (layer) {
|
30
|
+
layer.off(L.FeatureGroup.EVENTS, this._propagateEvent, this);
|
31
|
+
|
32
|
+
L.LayerGroup.prototype.removeLayer.call(this, layer);
|
33
|
+
|
34
|
+
if (this._popupContent) {
|
35
|
+
this.invoke('unbindPopup');
|
36
|
+
}
|
37
|
+
|
38
|
+
return this.fire('layerremove', {layer: layer});
|
39
|
+
},
|
40
|
+
|
41
|
+
bindPopup: function (content, options) {
|
42
|
+
this._popupContent = content;
|
43
|
+
this._popupOptions = options;
|
44
|
+
return this.invoke('bindPopup', content, options);
|
45
|
+
},
|
46
|
+
|
47
|
+
setStyle: function (style) {
|
48
|
+
return this.invoke('setStyle', style);
|
49
|
+
},
|
50
|
+
|
51
|
+
bringToFront: function () {
|
52
|
+
return this.invoke('bringToFront');
|
53
|
+
},
|
54
|
+
|
55
|
+
bringToBack: function () {
|
56
|
+
return this.invoke('bringToBack');
|
57
|
+
},
|
58
|
+
|
59
|
+
getBounds: function () {
|
60
|
+
var bounds = new L.LatLngBounds();
|
61
|
+
|
62
|
+
this.eachLayer(function (layer) {
|
63
|
+
bounds.extend(layer instanceof L.Marker ? layer.getLatLng() : layer.getBounds());
|
64
|
+
});
|
65
|
+
|
66
|
+
return bounds;
|
67
|
+
},
|
68
|
+
|
69
|
+
_propagateEvent: function (e) {
|
70
|
+
if (!e.layer) {
|
71
|
+
e.layer = e.target;
|
72
|
+
}
|
73
|
+
e.target = this;
|
74
|
+
|
75
|
+
this.fire(e.type, e);
|
76
|
+
}
|
77
|
+
});
|
78
|
+
|
79
|
+
L.featureGroup = function (layers) {
|
80
|
+
return new L.FeatureGroup(layers);
|
81
|
+
};
|
@@ -0,0 +1,245 @@
|
|
1
|
+
/*
|
2
|
+
* L.GeoJSON turns any GeoJSON data into a Leaflet layer.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.GeoJSON = L.FeatureGroup.extend({
|
6
|
+
|
7
|
+
initialize: function (geojson, options) {
|
8
|
+
L.setOptions(this, options);
|
9
|
+
|
10
|
+
this._layers = {};
|
11
|
+
|
12
|
+
if (geojson) {
|
13
|
+
this.addData(geojson);
|
14
|
+
}
|
15
|
+
},
|
16
|
+
|
17
|
+
addData: function (geojson) {
|
18
|
+
var features = L.Util.isArray(geojson) ? geojson : geojson.features,
|
19
|
+
i, len;
|
20
|
+
|
21
|
+
if (features) {
|
22
|
+
for (i = 0, len = features.length; i < len; i++) {
|
23
|
+
// Only add this if geometry or geometries are set and not null
|
24
|
+
if (features[i].geometries || features[i].geometry || features[i].features) {
|
25
|
+
this.addData(features[i]);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
return this;
|
29
|
+
}
|
30
|
+
|
31
|
+
var options = this.options;
|
32
|
+
|
33
|
+
if (options.filter && !options.filter(geojson)) { return; }
|
34
|
+
|
35
|
+
var layer = L.GeoJSON.geometryToLayer(geojson, options.pointToLayer, options.coordsToLatLng);
|
36
|
+
layer.feature = geojson;
|
37
|
+
|
38
|
+
layer.defaultOptions = layer.options;
|
39
|
+
this.resetStyle(layer);
|
40
|
+
|
41
|
+
if (options.onEachFeature) {
|
42
|
+
options.onEachFeature(geojson, layer);
|
43
|
+
}
|
44
|
+
|
45
|
+
return this.addLayer(layer);
|
46
|
+
},
|
47
|
+
|
48
|
+
resetStyle: function (layer) {
|
49
|
+
var style = this.options.style;
|
50
|
+
if (style) {
|
51
|
+
// reset any custom styles
|
52
|
+
L.Util.extend(layer.options, layer.defaultOptions);
|
53
|
+
|
54
|
+
this._setLayerStyle(layer, style);
|
55
|
+
}
|
56
|
+
},
|
57
|
+
|
58
|
+
setStyle: function (style) {
|
59
|
+
this.eachLayer(function (layer) {
|
60
|
+
this._setLayerStyle(layer, style);
|
61
|
+
}, this);
|
62
|
+
},
|
63
|
+
|
64
|
+
_setLayerStyle: function (layer, style) {
|
65
|
+
if (typeof style === 'function') {
|
66
|
+
style = style(layer.feature);
|
67
|
+
}
|
68
|
+
if (layer.setStyle) {
|
69
|
+
layer.setStyle(style);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
74
|
+
L.extend(L.GeoJSON, {
|
75
|
+
geometryToLayer: function (geojson, pointToLayer, coordsToLatLng) {
|
76
|
+
var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,
|
77
|
+
coords = geometry.coordinates,
|
78
|
+
layers = [],
|
79
|
+
latlng, latlngs, i, len, layer;
|
80
|
+
|
81
|
+
coordsToLatLng = coordsToLatLng || this.coordsToLatLng;
|
82
|
+
|
83
|
+
switch (geometry.type) {
|
84
|
+
case 'Point':
|
85
|
+
latlng = coordsToLatLng(coords);
|
86
|
+
return pointToLayer ? pointToLayer(geojson, latlng) : new L.Marker(latlng);
|
87
|
+
|
88
|
+
case 'MultiPoint':
|
89
|
+
for (i = 0, len = coords.length; i < len; i++) {
|
90
|
+
latlng = coordsToLatLng(coords[i]);
|
91
|
+
layer = pointToLayer ? pointToLayer(geojson, latlng) : new L.Marker(latlng);
|
92
|
+
layers.push(layer);
|
93
|
+
}
|
94
|
+
return new L.FeatureGroup(layers);
|
95
|
+
|
96
|
+
case 'LineString':
|
97
|
+
latlngs = this.coordsToLatLngs(coords, 0, coordsToLatLng);
|
98
|
+
return new L.Polyline(latlngs);
|
99
|
+
|
100
|
+
case 'Polygon':
|
101
|
+
latlngs = this.coordsToLatLngs(coords, 1, coordsToLatLng);
|
102
|
+
return new L.Polygon(latlngs);
|
103
|
+
|
104
|
+
case 'MultiLineString':
|
105
|
+
latlngs = this.coordsToLatLngs(coords, 1, coordsToLatLng);
|
106
|
+
return new L.MultiPolyline(latlngs);
|
107
|
+
|
108
|
+
case 'MultiPolygon':
|
109
|
+
latlngs = this.coordsToLatLngs(coords, 2, coordsToLatLng);
|
110
|
+
return new L.MultiPolygon(latlngs);
|
111
|
+
|
112
|
+
case 'GeometryCollection':
|
113
|
+
for (i = 0, len = geometry.geometries.length; i < len; i++) {
|
114
|
+
|
115
|
+
layer = this.geometryToLayer({
|
116
|
+
geometry: geometry.geometries[i],
|
117
|
+
type: 'Feature',
|
118
|
+
properties: geojson.properties
|
119
|
+
}, pointToLayer);
|
120
|
+
|
121
|
+
layers.push(layer);
|
122
|
+
}
|
123
|
+
return new L.FeatureGroup(layers);
|
124
|
+
|
125
|
+
default:
|
126
|
+
throw new Error('Invalid GeoJSON object.');
|
127
|
+
}
|
128
|
+
},
|
129
|
+
|
130
|
+
coordsToLatLng: function (coords) { // (Array[, Boolean]) -> LatLng
|
131
|
+
return new L.LatLng(coords[1], coords[0]);
|
132
|
+
},
|
133
|
+
|
134
|
+
coordsToLatLngs: function (coords, levelsDeep, coordsToLatLng) { // (Array[, Number, Function]) -> Array
|
135
|
+
var latlng, i, len,
|
136
|
+
latlngs = [];
|
137
|
+
|
138
|
+
for (i = 0, len = coords.length; i < len; i++) {
|
139
|
+
latlng = levelsDeep ?
|
140
|
+
this.coordsToLatLngs(coords[i], levelsDeep - 1, coordsToLatLng) :
|
141
|
+
(coordsToLatLng || this.coordsToLatLng)(coords[i]);
|
142
|
+
|
143
|
+
latlngs.push(latlng);
|
144
|
+
}
|
145
|
+
|
146
|
+
return latlngs;
|
147
|
+
},
|
148
|
+
|
149
|
+
latLngToCoords: function (latLng) {
|
150
|
+
return [latLng.lng, latLng.lat];
|
151
|
+
},
|
152
|
+
|
153
|
+
latLngsToCoords: function (latLngs) {
|
154
|
+
var coords = [];
|
155
|
+
|
156
|
+
for (var i = 0, len = latLngs.length; i < len; i++) {
|
157
|
+
coords.push(L.GeoJSON.latLngToCoords(latLngs[i]));
|
158
|
+
}
|
159
|
+
|
160
|
+
return coords;
|
161
|
+
}
|
162
|
+
});
|
163
|
+
|
164
|
+
L.Marker.include({
|
165
|
+
toGeoJSON: function () {
|
166
|
+
return {
|
167
|
+
type: 'Point',
|
168
|
+
coordinates: L.GeoJSON.latLngToCoords(this.getLatLng())
|
169
|
+
};
|
170
|
+
}
|
171
|
+
});
|
172
|
+
|
173
|
+
L.Polyline.include({
|
174
|
+
toGeoJSON: function () {
|
175
|
+
return {
|
176
|
+
type: 'LineString',
|
177
|
+
coordinates: L.GeoJSON.latLngsToCoords(this.getLatLngs())
|
178
|
+
};
|
179
|
+
}
|
180
|
+
});
|
181
|
+
|
182
|
+
L.Polygon.include({
|
183
|
+
toGeoJSON: function () {
|
184
|
+
var coords = [L.GeoJSON.latLngsToCoords(this.getLatLngs())],
|
185
|
+
i, len, hole;
|
186
|
+
|
187
|
+
coords[0].push(coords[0][0]);
|
188
|
+
|
189
|
+
if (this._holes) {
|
190
|
+
for (i = 0, len = this._holes.length; i < len; i++) {
|
191
|
+
hole = L.GeoJSON.latLngsToCoords(this._holes[i]);
|
192
|
+
hole.push(hole[0]);
|
193
|
+
coords.push(hole);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
return {
|
198
|
+
type: 'Polygon',
|
199
|
+
coordinates: coords
|
200
|
+
};
|
201
|
+
}
|
202
|
+
});
|
203
|
+
|
204
|
+
(function () {
|
205
|
+
function includeMulti(Klass, type) {
|
206
|
+
Klass.include({
|
207
|
+
toGeoJSON: function () {
|
208
|
+
var coords = [];
|
209
|
+
|
210
|
+
this.eachLayer(function (layer) {
|
211
|
+
coords.push(layer.toGeoJSON().coordinates);
|
212
|
+
});
|
213
|
+
|
214
|
+
return {
|
215
|
+
type: type,
|
216
|
+
coordinates: coords
|
217
|
+
};
|
218
|
+
}
|
219
|
+
});
|
220
|
+
}
|
221
|
+
|
222
|
+
includeMulti(L.MultiPolyline, 'MultiLineString');
|
223
|
+
includeMulti(L.MultiPolygon, 'MultiPolygon');
|
224
|
+
}());
|
225
|
+
|
226
|
+
L.LayerGroup.include({
|
227
|
+
toGeoJSON: function () {
|
228
|
+
var geoms = [];
|
229
|
+
|
230
|
+
this.eachLayer(function (layer) {
|
231
|
+
if (layer.toGeoJSON) {
|
232
|
+
geoms.push(layer.toGeoJSON());
|
233
|
+
}
|
234
|
+
});
|
235
|
+
|
236
|
+
return {
|
237
|
+
type: 'GeometryCollection',
|
238
|
+
geometries: geoms
|
239
|
+
};
|
240
|
+
}
|
241
|
+
});
|
242
|
+
|
243
|
+
L.geoJson = function (geojson, options) {
|
244
|
+
return new L.GeoJSON(geojson, options);
|
245
|
+
};
|
@@ -0,0 +1,132 @@
|
|
1
|
+
/*
|
2
|
+
* L.ImageOverlay is used to overlay images over the map (to specific geographical bounds).
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.ImageOverlay = L.Class.extend({
|
6
|
+
includes: L.Mixin.Events,
|
7
|
+
|
8
|
+
options: {
|
9
|
+
opacity: 1
|
10
|
+
},
|
11
|
+
|
12
|
+
initialize: function (url, bounds, options) { // (String, LatLngBounds, Object)
|
13
|
+
this._url = url;
|
14
|
+
this._bounds = L.latLngBounds(bounds);
|
15
|
+
|
16
|
+
L.setOptions(this, options);
|
17
|
+
},
|
18
|
+
|
19
|
+
onAdd: function (map) {
|
20
|
+
this._map = map;
|
21
|
+
|
22
|
+
if (!this._image) {
|
23
|
+
this._initImage();
|
24
|
+
}
|
25
|
+
|
26
|
+
map._panes.overlayPane.appendChild(this._image);
|
27
|
+
|
28
|
+
map.on('viewreset', this._reset, this);
|
29
|
+
|
30
|
+
if (map.options.zoomAnimation && L.Browser.any3d) {
|
31
|
+
map.on('zoomanim', this._animateZoom, this);
|
32
|
+
}
|
33
|
+
|
34
|
+
this._reset();
|
35
|
+
},
|
36
|
+
|
37
|
+
onRemove: function (map) {
|
38
|
+
map.getPanes().overlayPane.removeChild(this._image);
|
39
|
+
|
40
|
+
map.off('viewreset', this._reset, this);
|
41
|
+
|
42
|
+
if (map.options.zoomAnimation) {
|
43
|
+
map.off('zoomanim', this._animateZoom, this);
|
44
|
+
}
|
45
|
+
},
|
46
|
+
|
47
|
+
addTo: function (map) {
|
48
|
+
map.addLayer(this);
|
49
|
+
return this;
|
50
|
+
},
|
51
|
+
|
52
|
+
setOpacity: function (opacity) {
|
53
|
+
this.options.opacity = opacity;
|
54
|
+
this._updateOpacity();
|
55
|
+
return this;
|
56
|
+
},
|
57
|
+
|
58
|
+
// TODO remove bringToFront/bringToBack duplication from TileLayer/Path
|
59
|
+
bringToFront: function () {
|
60
|
+
if (this._image) {
|
61
|
+
this._map._panes.overlayPane.appendChild(this._image);
|
62
|
+
}
|
63
|
+
return this;
|
64
|
+
},
|
65
|
+
|
66
|
+
bringToBack: function () {
|
67
|
+
var pane = this._map._panes.overlayPane;
|
68
|
+
if (this._image) {
|
69
|
+
pane.insertBefore(this._image, pane.firstChild);
|
70
|
+
}
|
71
|
+
return this;
|
72
|
+
},
|
73
|
+
|
74
|
+
_initImage: function () {
|
75
|
+
this._image = L.DomUtil.create('img', 'leaflet-image-layer');
|
76
|
+
|
77
|
+
if (this._map.options.zoomAnimation && L.Browser.any3d) {
|
78
|
+
L.DomUtil.addClass(this._image, 'leaflet-zoom-animated');
|
79
|
+
} else {
|
80
|
+
L.DomUtil.addClass(this._image, 'leaflet-zoom-hide');
|
81
|
+
}
|
82
|
+
|
83
|
+
this._updateOpacity();
|
84
|
+
|
85
|
+
//TODO createImage util method to remove duplication
|
86
|
+
L.extend(this._image, {
|
87
|
+
galleryimg: 'no',
|
88
|
+
onselectstart: L.Util.falseFn,
|
89
|
+
onmousemove: L.Util.falseFn,
|
90
|
+
onload: L.bind(this._onImageLoad, this),
|
91
|
+
src: this._url
|
92
|
+
});
|
93
|
+
},
|
94
|
+
|
95
|
+
_animateZoom: function (e) {
|
96
|
+
var map = this._map,
|
97
|
+
image = this._image,
|
98
|
+
scale = map.getZoomScale(e.zoom),
|
99
|
+
nw = this._bounds.getNorthWest(),
|
100
|
+
se = this._bounds.getSouthEast(),
|
101
|
+
|
102
|
+
topLeft = map._latLngToNewLayerPoint(nw, e.zoom, e.center),
|
103
|
+
size = map._latLngToNewLayerPoint(se, e.zoom, e.center)._subtract(topLeft),
|
104
|
+
origin = topLeft._add(size._multiplyBy((1 / 2) * (1 - 1 / scale)));
|
105
|
+
|
106
|
+
image.style[L.DomUtil.TRANSFORM] =
|
107
|
+
L.DomUtil.getTranslateString(origin) + ' scale(' + scale + ') ';
|
108
|
+
},
|
109
|
+
|
110
|
+
_reset: function () {
|
111
|
+
var image = this._image,
|
112
|
+
topLeft = this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
|
113
|
+
size = this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(topLeft);
|
114
|
+
|
115
|
+
L.DomUtil.setPosition(image, topLeft);
|
116
|
+
|
117
|
+
image.style.width = size.x + 'px';
|
118
|
+
image.style.height = size.y + 'px';
|
119
|
+
},
|
120
|
+
|
121
|
+
_onImageLoad: function () {
|
122
|
+
this.fire('load');
|
123
|
+
},
|
124
|
+
|
125
|
+
_updateOpacity: function () {
|
126
|
+
L.DomUtil.setOpacity(this._image, this.options.opacity);
|
127
|
+
}
|
128
|
+
});
|
129
|
+
|
130
|
+
L.imageOverlay = function (url, bounds, options) {
|
131
|
+
return new L.ImageOverlay(url, bounds, options);
|
132
|
+
};
|