leaflet-js 0.6.beta4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/CHANGELOG.rdoc +3 -0
- data/leaflet-js.gemspec +2 -2
- data/lib/leaflet.draw/CHANGELOG.md +45 -0
- data/lib/leaflet.draw/README.md +70 -23
- data/lib/leaflet.draw/build/deps.js +1 -0
- data/lib/leaflet.draw/dist/images/spritesheet-2x.png +0 -0
- data/lib/leaflet.draw/dist/images/spritesheet.png +0 -0
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +489 -136
- data/lib/leaflet.draw/dist/leaflet.draw.css +34 -2
- data/lib/leaflet.draw/dist/leaflet.draw.ie.css +5 -0
- data/lib/leaflet.draw/dist/leaflet.draw.js +2 -2
- data/lib/leaflet.draw/examples/basic.html +14 -7
- data/lib/leaflet.draw/examples/libs/images/layers-2x.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/layers.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon-2x.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +1129 -608
- data/lib/leaflet.draw/examples/libs/leaflet.css +85 -66
- data/lib/leaflet.draw/package.json +2 -2
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +1 -1
- data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +25 -0
- data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +9 -0
- data/lib/leaflet.draw/src/Control.Draw.js +1 -0
- data/lib/leaflet.draw/src/Leaflet.draw.js +89 -1
- data/lib/leaflet.draw/src/Toolbar.js +2 -6
- data/lib/leaflet.draw/src/Tooltip.js +20 -7
- data/lib/leaflet.draw/src/draw/DrawToolbar.js +26 -22
- data/lib/leaflet.draw/src/draw/handler/Draw.Circle.js +11 -6
- data/lib/leaflet.draw/src/draw/handler/Draw.Feature.js +6 -2
- data/lib/leaflet.draw/src/draw/handler/Draw.Marker.js +7 -2
- data/lib/leaflet.draw/src/draw/handler/Draw.Polygon.js +29 -7
- data/lib/leaflet.draw/src/draw/handler/Draw.Polyline.js +44 -21
- data/lib/leaflet.draw/src/draw/handler/Draw.Rectangle.js +3 -3
- data/lib/leaflet.draw/src/draw/handler/Draw.SimpleShape.js +14 -1
- data/lib/leaflet.draw/src/edit/EditToolbar.js +86 -16
- data/lib/leaflet.draw/src/edit/handler/Edit.Poly.js +10 -7
- data/lib/leaflet.draw/src/edit/handler/Edit.SimpleShape.js +1 -2
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Delete.js +15 -3
- data/lib/leaflet.draw/src/edit/handler/EditToolbar.Edit.js +56 -38
- data/lib/leaflet.draw/src/ext/GeometryUtil.js +68 -0
- data/lib/leaflet.draw/src/images/spritesheet.svg +41 -0
- data/lib/leaflet.label/CHANGELOG.md +32 -0
- data/lib/leaflet.label/README.md +21 -4
- data/lib/leaflet.label/build/build.js +2 -2
- data/lib/leaflet.label/build/deps.js +2 -0
- data/lib/leaflet.label/build/hintrc.js +4 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +266 -83
- data/lib/leaflet.label/dist/leaflet.label.css +23 -4
- data/lib/leaflet.label/dist/leaflet.label.js +1 -1
- data/lib/leaflet.label/example/label.html +6 -3
- data/lib/leaflet.label/libs/leaflet/images/layers-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/leaflet-src.js +1129 -608
- data/lib/leaflet.label/libs/leaflet/leaflet.css +85 -66
- data/lib/leaflet.label/libs/leaflet/leaflet.js +6 -5
- data/lib/leaflet.label/package.json +19 -0
- data/lib/leaflet.label/src/BaseMarkerMethods.js +129 -0
- data/lib/leaflet.label/src/CircleMarker.Label.js +7 -0
- data/lib/leaflet.label/src/Label.js +161 -37
- data/lib/leaflet.label/src/Leaflet.label.js +1 -1
- data/lib/leaflet.label/src/Map.Label.js +0 -2
- data/lib/leaflet.label/src/Marker.Label.js +15 -120
- data/lib/leaflet.label/src/Path.Label.js +11 -11
- data/lib/leaflet/CHANGELOG.md +299 -31
- data/lib/leaflet/CONTRIBUTING.md +3 -3
- data/lib/leaflet/FAQ.md +138 -0
- data/lib/leaflet/Jakefile.js +24 -4
- data/lib/leaflet/PLUGIN-GUIDE.md +127 -0
- data/lib/leaflet/README.md +10 -6
- data/lib/leaflet/build/build.html +3 -19
- data/lib/leaflet/build/build.js +21 -51
- data/lib/leaflet/build/deps.js +10 -7
- data/lib/leaflet/build/hintrc.js +6 -4
- data/lib/leaflet/debug/hacks/jitter.html +0 -1
- data/lib/leaflet/debug/map/canvas.html +11 -12
- data/lib/leaflet/debug/map/controls.html +3 -4
- data/lib/leaflet/debug/map/geolocation.html +0 -1
- data/lib/leaflet/debug/map/iframe.html +11 -0
- data/lib/leaflet/debug/map/image-overlay.html +0 -1
- data/lib/leaflet/debug/map/map-mobile.html +0 -1
- data/lib/leaflet/debug/map/map.html +1 -2
- data/lib/leaflet/debug/map/max-bounds.html +2 -1
- data/lib/leaflet/debug/map/opacity.html +223 -0
- data/lib/leaflet/debug/map/scroll.html +6 -1
- data/lib/leaflet/debug/map/simple-proj.html +0 -1
- data/lib/leaflet/debug/map/wms-marble.html +4 -5
- data/lib/leaflet/debug/map/wms.html +0 -1
- data/lib/leaflet/debug/map/zoomlevels.html +0 -1
- data/lib/leaflet/debug/tests/add_remove_layers.html +5 -6
- data/lib/leaflet/debug/tests/bringtoback.html +0 -1
- data/lib/leaflet/debug/tests/canvasloop.html +47 -0
- data/lib/leaflet/debug/tests/click_on_canvas.html +0 -1
- data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +61 -0
- data/lib/leaflet/debug/tests/opacity.html +0 -1
- data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +59 -0
- data/lib/leaflet/debug/tests/remove_while_dragging.html +4 -5
- data/lib/leaflet/debug/tests/removetilewhilepan.html +0 -1
- data/lib/leaflet/debug/tests/reuse_popups.html +0 -1
- data/lib/leaflet/debug/tests/rtl.html +42 -0
- data/lib/leaflet/debug/tests/rtl2.html +27 -0
- data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +43 -0
- data/lib/leaflet/debug/tests/svg_clicks.html +3 -4
- data/lib/leaflet/debug/vector/bounds-extend.html +0 -1
- data/lib/leaflet/debug/vector/feature-group-bounds.html +0 -1
- data/lib/leaflet/debug/vector/geojson.html +0 -1
- data/lib/leaflet/debug/vector/rectangle.html +0 -1
- data/lib/leaflet/debug/vector/touchzoomemu.html +2 -3
- data/lib/leaflet/debug/vector/vector-bounds.html +0 -1
- data/lib/leaflet/debug/vector/vector-canvas.html +0 -1
- data/lib/leaflet/debug/vector/vector-mobile.html +0 -1
- data/lib/leaflet/debug/vector/vector-simple.html +0 -1
- data/lib/leaflet/debug/vector/vector.html +0 -1
- data/lib/leaflet/dist/images/layers-2x.png +0 -0
- data/lib/leaflet/dist/images/layers.png +0 -0
- data/lib/leaflet/dist/leaflet.css +85 -66
- data/lib/leaflet/package.json +25 -20
- data/lib/leaflet/spec/after.js +1 -1
- data/lib/leaflet/spec/index.html +21 -13
- data/lib/leaflet/spec/karma.conf.js +51 -50
- data/lib/leaflet/spec/spec.hintrc.js +25 -0
- data/lib/leaflet/spec/suites/LeafletSpec.js +2 -2
- data/lib/leaflet/spec/suites/SpecHelper.js +37 -21
- data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +1 -1
- data/lib/leaflet/spec/suites/core/ClassSpec.js +12 -12
- data/lib/leaflet/spec/suites/core/EventsSpec.js +74 -18
- data/lib/leaflet/spec/suites/core/UtilSpec.js +69 -25
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +16 -16
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +9 -16
- data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +27 -0
- data/lib/leaflet/spec/suites/geo/CRSSpec.js +47 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +22 -14
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +22 -8
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +21 -20
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +15 -15
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +12 -12
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +4 -4
- data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +59 -9
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +213 -17
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +6 -6
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +65 -5
- data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +16 -15
- data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +94 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +7 -7
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +38 -2
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +4 -4
- data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +2 -2
- data/lib/leaflet/spec/suites/map/MapSpec.js +318 -26
- data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +38 -0
- data/lib/leaflet/src/Leaflet.js +2 -2
- data/lib/leaflet/src/control/Control.Attribution.js +6 -0
- data/lib/leaflet/src/control/Control.Layers.js +33 -24
- data/lib/leaflet/src/control/Control.Zoom.js +12 -4
- data/lib/leaflet/src/control/Control.js +10 -0
- data/lib/leaflet/src/copyright.js +2 -1
- data/lib/leaflet/src/core/Browser.js +11 -10
- data/lib/leaflet/src/core/Events.js +15 -11
- data/lib/leaflet/src/core/Util.js +19 -14
- data/lib/leaflet/src/dom/DomEvent.DoubleTap.js +13 -12
- data/lib/leaflet/src/dom/DomEvent.Pointer.js +155 -0
- data/lib/leaflet/src/dom/DomEvent.js +57 -19
- data/lib/leaflet/src/dom/DomUtil.js +89 -34
- data/lib/leaflet/src/dom/Draggable.js +26 -89
- data/lib/leaflet/src/dom/PosAnimation.js +13 -2
- data/lib/leaflet/src/geo/LatLng.js +16 -5
- data/lib/leaflet/src/geo/LatLngBounds.js +5 -2
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +2 -2
- data/lib/leaflet/src/geo/crs/CRS.js +5 -0
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +3 -3
- data/lib/leaflet/src/geometry/LineUtil.js +2 -2
- data/lib/leaflet/src/images/layers.svg +8 -0
- data/lib/leaflet/src/images/marker.svg +61 -1
- data/lib/leaflet/src/layer/FeatureGroup.js +24 -7
- data/lib/leaflet/src/layer/GeoJSON.js +97 -56
- data/lib/leaflet/src/layer/ImageOverlay.js +9 -0
- data/lib/leaflet/src/layer/LayerGroup.js +8 -3
- data/lib/leaflet/src/layer/Popup.js +56 -34
- data/lib/leaflet/src/layer/marker/DivIcon.js +4 -2
- data/lib/leaflet/src/layer/marker/Icon.Default.js +1 -1
- data/lib/leaflet/src/layer/marker/Icon.js +15 -18
- data/lib/leaflet/src/layer/marker/Marker.Drag.js +7 -5
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +22 -5
- data/lib/leaflet/src/layer/marker/Marker.js +75 -32
- data/lib/leaflet/src/layer/tile/TileLayer.Anim.js +14 -26
- data/lib/leaflet/src/layer/tile/TileLayer.Canvas.js +7 -6
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +14 -10
- data/lib/leaflet/src/layer/tile/TileLayer.js +53 -32
- data/lib/leaflet/src/layer/vector/CircleMarker.js +11 -0
- data/lib/leaflet/src/layer/vector/MultiPoly.js +10 -0
- data/lib/leaflet/src/layer/vector/Path.SVG.js +14 -3
- data/lib/leaflet/src/layer/vector/Path.VML.js +12 -2
- data/lib/leaflet/src/layer/vector/Path.js +7 -3
- data/lib/leaflet/src/layer/vector/Polygon.js +14 -3
- data/lib/leaflet/src/layer/vector/canvas/CircleMarker.Canvas.js +9 -0
- data/lib/leaflet/src/layer/vector/canvas/Path.Canvas.js +1 -0
- data/lib/leaflet/src/map/Map.js +192 -125
- data/lib/leaflet/src/map/anim/Map.PanAnimation.js +29 -19
- data/lib/leaflet/src/map/anim/Map.ZoomAnimation.js +21 -9
- data/lib/leaflet/src/map/ext/Map.Geolocation.js +11 -4
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +26 -12
- data/lib/leaflet/src/map/handler/Map.DoubleClickZoom.js +10 -3
- data/lib/leaflet/src/map/handler/Map.Drag.js +12 -6
- data/lib/leaflet/src/map/handler/Map.Keyboard.js +5 -2
- data/lib/leaflet/src/map/handler/Map.ScrollWheelZoom.js +7 -1
- data/lib/leaflet/src/map/handler/Map.Tap.js +107 -0
- data/lib/leaflet/src/map/handler/Map.TouchZoom.js +9 -3
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/spritesheet-2x.png +0 -0
- data/vendor/assets/images/spritesheet.png +0 -0
- data/vendor/assets/javascripts/leaflet.draw.js +2 -4
- data/vendor/assets/javascripts/leaflet.js +3 -1
- data/vendor/assets/javascripts/leaflet.label.js +2 -0
- data/vendor/assets/stylesheets/leaflet.css.erb +337 -318
- data/vendor/assets/stylesheets/leaflet.draw.css.erb +35 -3
- data/vendor/assets/stylesheets/leaflet.draw.ie.css +5 -0
- data/vendor/assets/stylesheets/leaflet.label.css +23 -4
- metadata +40 -14
- data/lib/leaflet.draw/examples/libs/leaflet.ie.css +0 -51
- data/lib/leaflet.label/libs/leaflet/leaflet.ie.css +0 -51
- data/lib/leaflet/dist/leaflet-src.js +0 -8579
- data/lib/leaflet/dist/leaflet.ie.css +0 -51
- data/lib/leaflet/dist/leaflet.js +0 -8
- data/lib/leaflet/spec/happen.js +0 -93
- data/lib/leaflet/src/dom/DomEvent.MsTouch.js +0 -146
- data/vendor/assets/stylesheets/leaflet.ie.css +0 -51
@@ -13,6 +13,11 @@ L.TileLayer.Canvas = L.TileLayer.extend({
|
|
13
13
|
},
|
14
14
|
|
15
15
|
redraw: function () {
|
16
|
+
if (this._map) {
|
17
|
+
this._reset({hard: true});
|
18
|
+
this._update();
|
19
|
+
}
|
20
|
+
|
16
21
|
for (var i in this._tiles) {
|
17
22
|
this._redrawTile(this._tiles[i]);
|
18
23
|
}
|
@@ -23,13 +28,9 @@ L.TileLayer.Canvas = L.TileLayer.extend({
|
|
23
28
|
this.drawTile(tile, tile._tilePoint, this._map._zoom);
|
24
29
|
},
|
25
30
|
|
26
|
-
_createTileProto: function () {
|
27
|
-
var proto = this._canvasProto = L.DomUtil.create('canvas', 'leaflet-tile');
|
28
|
-
proto.width = proto.height = this.options.tileSize;
|
29
|
-
},
|
30
|
-
|
31
31
|
_createTile: function () {
|
32
|
-
var tile =
|
32
|
+
var tile = L.DomUtil.create('canvas', 'leaflet-tile');
|
33
|
+
tile.width = tile.height = this.options.tileSize;
|
33
34
|
tile.onselectstart = tile.onmousemove = L.Util.falseFn;
|
34
35
|
return tile;
|
35
36
|
},
|
@@ -29,7 +29,7 @@ L.TileLayer.WMS = L.TileLayer.extend({
|
|
29
29
|
|
30
30
|
for (var i in options) {
|
31
31
|
// all keys that are not TileLayer options go to WMS params
|
32
|
-
if (!this.options.hasOwnProperty(i)) {
|
32
|
+
if (!this.options.hasOwnProperty(i) && i !== 'crs') {
|
33
33
|
wmsParams[i] = options[i];
|
34
34
|
}
|
35
35
|
}
|
@@ -41,29 +41,33 @@ L.TileLayer.WMS = L.TileLayer.extend({
|
|
41
41
|
|
42
42
|
onAdd: function (map) {
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
this._crs = this.options.crs || map.options.crs;
|
45
|
+
|
46
|
+
this._wmsVersion = parseFloat(this.wmsParams.version);
|
47
|
+
|
48
|
+
var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs';
|
49
|
+
this.wmsParams[projectionKey] = this._crs.code;
|
46
50
|
|
47
51
|
L.TileLayer.prototype.onAdd.call(this, map);
|
48
52
|
},
|
49
53
|
|
50
|
-
getTileUrl: function (tilePoint
|
54
|
+
getTileUrl: function (tilePoint) { // (Point, Number) -> String
|
51
55
|
|
52
56
|
var map = this._map,
|
53
|
-
crs = map.options.crs,
|
54
57
|
tileSize = this.options.tileSize,
|
55
58
|
|
56
59
|
nwPoint = tilePoint.multiplyBy(tileSize),
|
57
60
|
sePoint = nwPoint.add([tileSize, tileSize]),
|
58
61
|
|
59
|
-
nw =
|
60
|
-
se =
|
61
|
-
|
62
|
-
|
62
|
+
nw = this._crs.project(map.unproject(nwPoint, tilePoint.z)),
|
63
|
+
se = this._crs.project(map.unproject(sePoint, tilePoint.z)),
|
64
|
+
bbox = this._wmsVersion >= 1.3 && this._crs === L.CRS.EPSG4326 ?
|
65
|
+
[se.y, nw.x, nw.y, se.x].join(',') :
|
66
|
+
[nw.x, se.y, se.x, nw.y].join(','),
|
63
67
|
|
64
68
|
url = L.Util.template(this._url, {s: this._getSubdomain(tilePoint)});
|
65
69
|
|
66
|
-
return url + L.Util.getParamString(this.wmsParams, url) + '&
|
70
|
+
return url + L.Util.getParamString(this.wmsParams, url, true) + '&BBOX=' + bbox;
|
67
71
|
},
|
68
72
|
|
69
73
|
setParams: function (params, noRedraw) {
|
@@ -14,7 +14,8 @@ L.TileLayer = L.Class.extend({
|
|
14
14
|
attribution: '',
|
15
15
|
zoomOffset: 0,
|
16
16
|
opacity: 1,
|
17
|
-
/*
|
17
|
+
/*
|
18
|
+
maxNativeZoom: null,
|
18
19
|
zIndex: null,
|
19
20
|
tms: false,
|
20
21
|
continuousWorld: false,
|
@@ -58,14 +59,11 @@ L.TileLayer = L.Class.extend({
|
|
58
59
|
|
59
60
|
onAdd: function (map) {
|
60
61
|
this._map = map;
|
61
|
-
this._animated = map.
|
62
|
+
this._animated = map._zoomAnimated;
|
62
63
|
|
63
64
|
// create a container div for tiles
|
64
65
|
this._initContainer();
|
65
66
|
|
66
|
-
// create an image to clone for tiles
|
67
|
-
this._createTileProto();
|
68
|
-
|
69
67
|
// set up events
|
70
68
|
map.on({
|
71
69
|
'viewreset': this._reset,
|
@@ -219,13 +217,6 @@ L.TileLayer = L.Class.extend({
|
|
219
217
|
} else {
|
220
218
|
L.DomUtil.setOpacity(this._container, this.options.opacity);
|
221
219
|
}
|
222
|
-
|
223
|
-
// stupid webkit hack to force redrawing of tiles
|
224
|
-
if (L.Browser.webkit) {
|
225
|
-
for (i in tiles) {
|
226
|
-
tiles[i].style.webkitTransform += ' translate(0,0)';
|
227
|
-
}
|
228
|
-
}
|
229
220
|
},
|
230
221
|
|
231
222
|
_initContainer: function () {
|
@@ -237,10 +228,11 @@ L.TileLayer = L.Class.extend({
|
|
237
228
|
this._updateZIndex();
|
238
229
|
|
239
230
|
if (this._animated) {
|
240
|
-
var className = 'leaflet-tile-container
|
231
|
+
var className = 'leaflet-tile-container';
|
241
232
|
|
242
233
|
this._bgBuffer = L.DomUtil.create('div', className, this._container);
|
243
234
|
this._tileContainer = L.DomUtil.create('div', className, this._container);
|
235
|
+
|
244
236
|
} else {
|
245
237
|
this._tileContainer = this._container;
|
246
238
|
}
|
@@ -274,13 +266,27 @@ L.TileLayer = L.Class.extend({
|
|
274
266
|
this._initContainer();
|
275
267
|
},
|
276
268
|
|
269
|
+
_getTileSize: function () {
|
270
|
+
var map = this._map,
|
271
|
+
zoom = map.getZoom() + this.options.zoomOffset,
|
272
|
+
zoomN = this.options.maxNativeZoom,
|
273
|
+
tileSize = this.options.tileSize;
|
274
|
+
|
275
|
+
if (zoomN && zoom > zoomN) {
|
276
|
+
tileSize = Math.round(map.getZoomScale(zoom) / map.getZoomScale(zoomN) * tileSize);
|
277
|
+
}
|
278
|
+
|
279
|
+
return tileSize;
|
280
|
+
},
|
281
|
+
|
277
282
|
_update: function () {
|
278
283
|
|
279
284
|
if (!this._map) { return; }
|
280
285
|
|
281
|
-
var
|
282
|
-
|
283
|
-
|
286
|
+
var map = this._map,
|
287
|
+
bounds = map.getPixelBounds(),
|
288
|
+
zoom = map.getZoom(),
|
289
|
+
tileSize = this._getTileSize();
|
284
290
|
|
285
291
|
if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {
|
286
292
|
return;
|
@@ -345,12 +351,12 @@ L.TileLayer = L.Class.extend({
|
|
345
351
|
|
346
352
|
var options = this.options;
|
347
353
|
|
348
|
-
if (!options.continuousWorld
|
354
|
+
if (!options.continuousWorld) {
|
349
355
|
var limit = this._getWrapTileNum();
|
350
356
|
|
351
357
|
// don't load if exceeds world bounds
|
352
|
-
if (tilePoint.x < 0 || tilePoint.x >= limit ||
|
353
|
-
tilePoint.y < 0 || tilePoint.y >= limit) { return false; }
|
358
|
+
if ((options.noWrap && (tilePoint.x < 0 || tilePoint.x >= limit.x)) ||
|
359
|
+
tilePoint.y < 0 || tilePoint.y >= limit.y) { return false; }
|
354
360
|
}
|
355
361
|
|
356
362
|
if (options.bounds) {
|
@@ -443,12 +449,14 @@ L.TileLayer = L.Class.extend({
|
|
443
449
|
zoom = options.maxZoom - zoom;
|
444
450
|
}
|
445
451
|
|
446
|
-
|
452
|
+
zoom += options.zoomOffset;
|
453
|
+
|
454
|
+
return options.maxNativeZoom ? Math.min(zoom, options.maxNativeZoom) : zoom;
|
447
455
|
},
|
448
456
|
|
449
457
|
_getTilePos: function (tilePoint) {
|
450
458
|
var origin = this._map.getPixelOrigin(),
|
451
|
-
tileSize = this.
|
459
|
+
tileSize = this._getTileSize();
|
452
460
|
|
453
461
|
return tilePoint.multiplyBy(tileSize).subtract(origin);
|
454
462
|
},
|
@@ -465,8 +473,9 @@ L.TileLayer = L.Class.extend({
|
|
465
473
|
},
|
466
474
|
|
467
475
|
_getWrapTileNum: function () {
|
468
|
-
|
469
|
-
|
476
|
+
var crs = this._map.options.crs,
|
477
|
+
size = crs.getSize(this._map.getZoom());
|
478
|
+
return size.divideBy(this.options.tileSize);
|
470
479
|
},
|
471
480
|
|
472
481
|
_adjustTilePoint: function (tilePoint) {
|
@@ -475,11 +484,11 @@ L.TileLayer = L.Class.extend({
|
|
475
484
|
|
476
485
|
// wrap tile coordinates
|
477
486
|
if (!this.options.continuousWorld && !this.options.noWrap) {
|
478
|
-
tilePoint.x = ((tilePoint.x % limit) + limit) % limit;
|
487
|
+
tilePoint.x = ((tilePoint.x % limit.x) + limit.x) % limit.x;
|
479
488
|
}
|
480
489
|
|
481
490
|
if (this.options.tms) {
|
482
|
-
tilePoint.y = limit - tilePoint.y - 1;
|
491
|
+
tilePoint.y = limit.y - tilePoint.y - 1;
|
483
492
|
}
|
484
493
|
|
485
494
|
tilePoint.z = this._getZoomForUrl();
|
@@ -490,12 +499,6 @@ L.TileLayer = L.Class.extend({
|
|
490
499
|
return this.options.subdomains[index];
|
491
500
|
},
|
492
501
|
|
493
|
-
_createTileProto: function () {
|
494
|
-
var img = this._tileImg = L.DomUtil.create('img', 'leaflet-tile');
|
495
|
-
img.style.width = img.style.height = this.options.tileSize + 'px';
|
496
|
-
img.galleryimg = 'no';
|
497
|
-
},
|
498
|
-
|
499
502
|
_getTile: function () {
|
500
503
|
if (this.options.reuseTiles && this._unusedTiles.length > 0) {
|
501
504
|
var tile = this._unusedTiles.pop();
|
@@ -509,12 +512,20 @@ L.TileLayer = L.Class.extend({
|
|
509
512
|
_resetTile: function (/*tile*/) {},
|
510
513
|
|
511
514
|
_createTile: function () {
|
512
|
-
var tile =
|
515
|
+
var tile = L.DomUtil.create('img', 'leaflet-tile');
|
516
|
+
tile.style.width = tile.style.height = this._getTileSize() + 'px';
|
517
|
+
tile.galleryimg = 'no';
|
518
|
+
|
513
519
|
tile.onselectstart = tile.onmousemove = L.Util.falseFn;
|
514
520
|
|
515
521
|
if (L.Browser.ielt9 && this.options.opacity !== undefined) {
|
516
522
|
L.DomUtil.setOpacity(tile, this.options.opacity);
|
517
523
|
}
|
524
|
+
// without this hack, tiles disappear after zoom on Chrome for Android
|
525
|
+
// https://github.com/Leaflet/Leaflet/issues/2078
|
526
|
+
if (L.Browser.mobileWebkit3d) {
|
527
|
+
tile.style.WebkitBackfaceVisibility = 'hidden';
|
528
|
+
}
|
518
529
|
return tile;
|
519
530
|
},
|
520
531
|
|
@@ -525,10 +536,20 @@ L.TileLayer = L.Class.extend({
|
|
525
536
|
|
526
537
|
this._adjustTilePoint(tilePoint);
|
527
538
|
tile.src = this.getTileUrl(tilePoint);
|
539
|
+
|
540
|
+
this.fire('tileloadstart', {
|
541
|
+
tile: tile,
|
542
|
+
url: tile.src
|
543
|
+
});
|
528
544
|
},
|
529
545
|
|
530
546
|
_tileLoaded: function () {
|
531
547
|
this._tilesToLoad--;
|
548
|
+
|
549
|
+
if (this._animated) {
|
550
|
+
L.DomUtil.addClass(this._tileContainer, 'leaflet-zoom-animated');
|
551
|
+
}
|
552
|
+
|
532
553
|
if (!this._tilesToLoad) {
|
533
554
|
this.fire('load');
|
534
555
|
|
@@ -22,9 +22,20 @@ L.CircleMarker = L.Circle.extend({
|
|
22
22
|
this.setRadius(this.options.radius);
|
23
23
|
},
|
24
24
|
|
25
|
+
setLatLng: function (latlng) {
|
26
|
+
L.Circle.prototype.setLatLng.call(this, latlng);
|
27
|
+
if (this._popup && this._popup._isOpen) {
|
28
|
+
this._popup.setLatLng(latlng);
|
29
|
+
}
|
30
|
+
},
|
31
|
+
|
25
32
|
setRadius: function (radius) {
|
26
33
|
this.options.radius = this._radius = radius;
|
27
34
|
return this.redraw();
|
35
|
+
},
|
36
|
+
|
37
|
+
getRadius: function () {
|
38
|
+
return this._radius;
|
28
39
|
}
|
29
40
|
});
|
30
41
|
|
@@ -50,6 +50,11 @@ L.Path = L.Path.extend({
|
|
50
50
|
this._container = this._createElement('g');
|
51
51
|
|
52
52
|
this._path = this._createElement('path');
|
53
|
+
|
54
|
+
if (this.options.className) {
|
55
|
+
L.DomUtil.addClass(this._path, this.options.className);
|
56
|
+
}
|
57
|
+
|
53
58
|
this._container.appendChild(this._path);
|
54
59
|
},
|
55
60
|
|
@@ -80,6 +85,12 @@ L.Path = L.Path.extend({
|
|
80
85
|
} else {
|
81
86
|
this._path.removeAttribute('stroke-dasharray');
|
82
87
|
}
|
88
|
+
if (this.options.lineCap) {
|
89
|
+
this._path.setAttribute('stroke-linecap', this.options.lineCap);
|
90
|
+
}
|
91
|
+
if (this.options.lineJoin) {
|
92
|
+
this._path.setAttribute('stroke-linejoin', this.options.lineJoin);
|
93
|
+
}
|
83
94
|
} else {
|
84
95
|
this._path.setAttribute('stroke', 'none');
|
85
96
|
}
|
@@ -104,7 +115,7 @@ L.Path = L.Path.extend({
|
|
104
115
|
_initEvents: function () {
|
105
116
|
if (this.options.clickable) {
|
106
117
|
if (L.Browser.svg || !L.Browser.vml) {
|
107
|
-
this._path
|
118
|
+
L.DomUtil.addClass(this._path, 'leaflet-clickable');
|
108
119
|
}
|
109
120
|
|
110
121
|
L.DomEvent.on(this._container, 'click', this._onMouseClick, this);
|
@@ -154,14 +165,14 @@ L.Map.include({
|
|
154
165
|
this._panes.overlayPane.appendChild(this._pathRoot);
|
155
166
|
|
156
167
|
if (this.options.zoomAnimation && L.Browser.any3d) {
|
157
|
-
this._pathRoot
|
168
|
+
L.DomUtil.addClass(this._pathRoot, 'leaflet-zoom-animated');
|
158
169
|
|
159
170
|
this.on({
|
160
171
|
'zoomanim': this._animatePathZoom,
|
161
172
|
'zoomend': this._endPathZoom
|
162
173
|
});
|
163
174
|
} else {
|
164
|
-
this._pathRoot
|
175
|
+
L.DomUtil.addClass(this._pathRoot, 'leaflet-zoom-hide');
|
165
176
|
}
|
166
177
|
|
167
178
|
this.on('moveend', this._updateSvgViewport);
|
@@ -40,10 +40,14 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
|
|
40
40
|
|
41
41
|
_initPath: function () {
|
42
42
|
var container = this._container = this._createElement('shape');
|
43
|
-
|
43
|
+
|
44
|
+
L.DomUtil.addClass(container, 'leaflet-vml-shape' +
|
45
|
+
(this.options.className ? ' ' + this.options.className : ''));
|
46
|
+
|
44
47
|
if (this.options.clickable) {
|
45
48
|
L.DomUtil.addClass(container, 'leaflet-clickable');
|
46
49
|
}
|
50
|
+
|
47
51
|
container.coordsize = '1 1';
|
48
52
|
|
49
53
|
this._path = this._createElement('path');
|
@@ -76,12 +80,18 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
|
|
76
80
|
stroke.opacity = options.opacity;
|
77
81
|
|
78
82
|
if (options.dashArray) {
|
79
|
-
stroke.dashStyle = options.dashArray
|
83
|
+
stroke.dashStyle = L.Util.isArray(options.dashArray) ?
|
80
84
|
options.dashArray.join(' ') :
|
81
85
|
options.dashArray.replace(/( *, *)/g, ' ');
|
82
86
|
} else {
|
83
87
|
stroke.dashStyle = '';
|
84
88
|
}
|
89
|
+
if (options.lineCap) {
|
90
|
+
stroke.endcap = options.lineCap.replace('butt', 'flat');
|
91
|
+
}
|
92
|
+
if (options.lineJoin) {
|
93
|
+
stroke.joinstyle = options.lineJoin;
|
94
|
+
}
|
85
95
|
|
86
96
|
} else if (stroke) {
|
87
97
|
container.removeChild(stroke);
|
@@ -9,15 +9,19 @@ L.Path = L.Class.extend({
|
|
9
9
|
// how much to extend the clip area around the map view
|
10
10
|
// (relative to its size, e.g. 0.5 is half the screen in each direction)
|
11
11
|
// set it so that SVG element doesn't exceed 1280px (vectors flicker on dragend if it is)
|
12
|
-
CLIP_PADDING:
|
13
|
-
|
14
|
-
|
12
|
+
CLIP_PADDING: (function () {
|
13
|
+
var max = L.Browser.mobile ? 1280 : 2000,
|
14
|
+
target = (max / Math.max(window.outerWidth, window.outerHeight) - 1) / 2;
|
15
|
+
return Math.max(0, Math.min(0.5, target));
|
16
|
+
})()
|
15
17
|
},
|
16
18
|
|
17
19
|
options: {
|
18
20
|
stroke: true,
|
19
21
|
color: '#0033ff',
|
20
22
|
dashArray: null,
|
23
|
+
lineCap: null,
|
24
|
+
lineJoin: null,
|
21
25
|
weight: 5,
|
22
26
|
opacity: 0.5,
|
23
27
|
|
@@ -8,10 +8,12 @@ L.Polygon = L.Polyline.extend({
|
|
8
8
|
},
|
9
9
|
|
10
10
|
initialize: function (latlngs, options) {
|
11
|
-
var i, len, hole;
|
12
|
-
|
13
11
|
L.Polyline.prototype.initialize.call(this, latlngs, options);
|
12
|
+
this._initWithHoles(latlngs);
|
13
|
+
},
|
14
14
|
|
15
|
+
_initWithHoles: function (latlngs) {
|
16
|
+
var i, len, hole;
|
15
17
|
if (latlngs && L.Util.isArray(latlngs[0]) && (typeof latlngs[0][0] !== 'number')) {
|
16
18
|
this._latlngs = this._convertLatLngs(latlngs[0]);
|
17
19
|
this._holes = latlngs.slice(1);
|
@@ -27,7 +29,7 @@ L.Polygon = L.Polyline.extend({
|
|
27
29
|
// filter out last point if its equal to the first one
|
28
30
|
latlngs = this._latlngs;
|
29
31
|
|
30
|
-
if (latlngs[0].equals(latlngs[latlngs.length - 1])) {
|
32
|
+
if (latlngs.length >= 2 && latlngs[0].equals(latlngs[latlngs.length - 1])) {
|
31
33
|
latlngs.pop();
|
32
34
|
}
|
33
35
|
},
|
@@ -52,6 +54,15 @@ L.Polygon = L.Polyline.extend({
|
|
52
54
|
}
|
53
55
|
},
|
54
56
|
|
57
|
+
setLatLngs: function (latlngs) {
|
58
|
+
if (latlngs && L.Util.isArray(latlngs[0]) && (typeof latlngs[0][0] !== 'number')) {
|
59
|
+
this._initWithHoles(latlngs);
|
60
|
+
return this.redraw();
|
61
|
+
} else {
|
62
|
+
return L.Polyline.prototype.setLatLngs.call(this, latlngs);
|
63
|
+
}
|
64
|
+
},
|
65
|
+
|
55
66
|
_clipPoints: function () {
|
56
67
|
var points = this._originalPoints,
|
57
68
|
newParts = [];
|