Update to Leaflet 0.5

This commit is contained in:
Tom Hughes 2013-01-17 17:44:10 +00:00
parent f05da909f5
commit 6bde69a840
13 changed files with 756 additions and 362 deletions

View file

@ -1,27 +1,27 @@
folder 'vendor/assets' do folder 'vendor/assets' do
folder 'leaflet' do folder 'leaflet' do
from 'https://github.com/CloudMade/Leaflet.git' do from 'git://github.com/Leaflet/Leaflet.git', :tag => 'v0.5' do
file 'leaflet.css', 'dist/leaflet.css' file 'leaflet.css', 'dist/leaflet.css'
file 'leaflet.ie.css', 'dist/leaflet.ie.css' file 'leaflet.ie.css', 'dist/leaflet.ie.css'
file 'leaflet.js', 'dist/leaflet-src.js' file 'leaflet.js', 'dist/leaflet-src.js'
folder 'images', 'dist/images' folder 'images', 'dist/images'
end end
from 'https://github.com/tripbirds/leaflet-locationfilter.git' do from 'git://github.com/kajic/leaflet-locationfilter.git' do
file 'leaflet.locationfilter.css', 'src/locationfilter.css' file 'leaflet.locationfilter.css', 'src/locationfilter.css'
file 'leaflet.locationfilter.js', 'src/locationfilter.js' file 'leaflet.locationfilter.js', 'src/locationfilter.js'
folder 'img', 'src/img' folder 'img', 'src/img'
end end
from 'https://github.com/kartena/Leaflet.Pancontrol.git' do from 'git://github.com/kartena/Leaflet.Pancontrol.git' do
file 'leaflet.pan.js', 'src/L.Control.Pan.js' file 'leaflet.pan.js', 'src/L.Control.Pan.js'
end end
from 'https://github.com/kartena/Leaflet.zoomslider.git' do from 'git://github.com/kartena/Leaflet.zoomslider.git' do
file 'leaflet.zoom.js', 'src/L.Control.Zoomslider.js' file 'leaflet.zoom.js', 'src/L.Control.Zoomslider.js'
end end
from 'https://github.com/jfirebaugh/leaflet-osm.git' do from 'git://github.com/jfirebaugh/leaflet-osm.git' do
file 'leaflet.osm.js', 'leaflet-osm.js' file 'leaflet.osm.js', 'leaflet-osm.js'
end end
end end

View file

@ -1,5 +1,5 @@
// Leaflet extensions // Leaflet extensions
L.LatLngBounds.include({ L.extend(L.LatLngBounds.prototype, {
getSouthLat: function () { getSouthLat: function () {
return this._southWest.lat; return this._southWest.lat;
}, },
@ -32,7 +32,7 @@ L.LatLngBounds.include({
} }
}); });
L.Bounds.include({ L.extend(L.Bounds.prototype, {
getWidth: function () { getWidth: function () {
return this.max.x - this.min.x; return this.max.x - this.min.x;
}, },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 973 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 797 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 955 B

View file

@ -15,6 +15,7 @@
.leaflet-layer { .leaflet-layer {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0;
} }
.leaflet-container { .leaflet-container {
overflow: hidden; overflow: hidden;
@ -184,25 +185,61 @@
/* general typography */ /* general typography */
.leaflet-container { .leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
} }
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 0 8px rgba(0,0,0,0.4);
border: 1px solid #888;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.leaflet-bar-part {
background-color: rgba(255, 255, 255, 0.8);
border-bottom: 1px solid #aaa;
}
.leaflet-bar-part-top {
-webkit-border-radius: 4px 4px 0 0;
border-radius: 4px 4px 0 0;
}
.leaflet-bar-part-bottom {
-webkit-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
border-bottom: none;
}
.leaflet-touch .leaflet-bar {
-webkit-border-radius: 10px;
border-radius: 10px;
}
.leaflet-touch .leaflet-bar-part {
border-bottom: 4px solid rgba(0,0,0,0.3);
}
.leaflet-touch .leaflet-bar-part-top {
-webkit-border-radius: 7px 7px 0 0;
border-radius: 7px 7px 0 0;
}
.leaflet-touch .leaflet-bar-part-bottom {
-webkit-border-radius: 0 0 7px 7px;
border-radius: 0 0 7px 7px;
border-bottom: none;
}
/* zoom control */ /* zoom control */
.leaflet-control-zoom { .leaflet-container .leaflet-control-zoom {
-webkit-border-radius: 7px; margin-left: 13px;
border-radius: 7px; margin-top: 12px;
}
.leaflet-control-zoom {
padding: 5px;
background: rgba(0, 0, 0, 0.25);
} }
.leaflet-control-zoom a { .leaflet-control-zoom a {
width: 19px; width: 22px;
height: 19px; height: 22px;
background-color: rgba(255, 255, 255, 0.75); text-align: center;
-webkit-border-radius: 4px; text-decoration: none;
border-radius: 4px; color: black;
} }
.leaflet-control-zoom a, .leaflet-control-zoom a,
.leaflet-control-layers-toggle { .leaflet-control-layers-toggle {
@ -212,24 +249,37 @@
} }
.leaflet-control-zoom a:hover { .leaflet-control-zoom a:hover {
background-color: #fff; background-color: #fff;
} color: #777;
.leaflet-touch .leaflet-control-zoom a {
width: 27px;
height: 27px;
} }
.leaflet-control-zoom-in { .leaflet-control-zoom-in {
background-image: url(images/zoom-in.png); font: bold 18px/24px Arial, Helvetica, sans-serif;
margin-bottom: 5px;
} }
.leaflet-control-zoom-out { .leaflet-control-zoom-out {
background-image: url(images/zoom-out.png); font: bold 23px/20px Tahoma, Verdana, sans-serif;
}
.leaflet-control-zoom a.leaflet-control-zoom-disabled {
cursor: default;
background-color: rgba(255, 255, 255, 0.8);
color: #bbb;
} }
.leaflet-touch .leaflet-control-zoom a {
width: 30px;
height: 30px;
}
.leaflet-touch .leaflet-control-zoom-in {
font-size: 24px;
line-height: 29px;
}
.leaflet-touch .leaflet-control-zoom-out {
font-size: 28px;
line-height: 24px;
}
/* layers control */ /* layers control */
.leaflet-control-layers { .leaflet-control-layers {
box-shadow: 0 1px 7px #999; box-shadow: 0 1px 7px rgba(0,0,0,0.4);
background: #f8f8f9; background: #f8f8f9;
-webkit-border-radius: 8px; -webkit-border-radius: 8px;
border-radius: 8px; border-radius: 8px;
@ -297,27 +347,33 @@
border: 2px solid #777; border: 2px solid #777;
border-top: none; border-top: none;
color: black; color: black;
line-height: 1; line-height: 1.1;
font-size: 10px; padding: 2px 5px 1px;
padding-bottom: 2px; font-size: 11px;
text-shadow: 1px 1px 1px #fff; text-shadow: 1px 1px 1px #fff;
background-color: rgba(255, 255, 255, 0.5); background-color: rgba(255, 255, 255, 0.5);
box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.2);
white-space: nowrap;
overflow: hidden;
} }
.leaflet-control-scale-line:not(:first-child) { .leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777; border-top: 2px solid #777;
padding-top: 1px;
border-bottom: none; border-bottom: none;
margin-top: -2px; margin-top: -2px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
} }
.leaflet-control-scale-line:not(:first-child):not(:last-child) { .leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777; border-bottom: 2px solid #777;
} }
.leaflet-touch .leaflet-control-attribution, .leaflet-touch .leaflet-control-layers { .leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-control-zoom {
box-shadow: none; box-shadow: none;
} }
.leaflet-touch .leaflet-control-layers { .leaflet-touch .leaflet-control-layers,
border: 5px solid #bbb; .leaflet-touch .leaflet-control-zoom {
border: 4px solid rgba(0,0,0,0.3);
} }
@ -363,8 +419,7 @@
.leaflet-popup-content-wrapper, .leaflet-popup-tip { .leaflet-popup-content-wrapper, .leaflet-popup-tip {
background: white; background: white;
box-shadow: 0 3px 14px rgba(0,0,0,0.35); box-shadow: 0 3px 14px rgba(0,0,0,0.4);
-webkit-box-shadow: 0 3px 18px rgba(0,0,0,0.33);
} }
.leaflet-container a.leaflet-popup-close-button { .leaflet-container a.leaflet-popup-close-button {
position: absolute; position: absolute;
@ -378,6 +433,7 @@
color: #c3c3c3; color: #c3c3c3;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
background: transparent;
} }
.leaflet-container a.leaflet-popup-close-button:hover { .leaflet-container a.leaflet-popup-close-button:hover {
color: #999; color: #999;

View file

@ -3,11 +3,11 @@
height: 1px; height: 1px;
} }
.lvml { .lvml {
behavior: url(#default#VML); behavior: url(#default#VML);
display: inline-block; display: inline-block;
position: absolute; position: absolute;
} }
.leaflet-control { .leaflet-control {
display: inline; display: inline;
} }
@ -17,7 +17,7 @@
_width: 27px; _width: 27px;
margin: 0 auto; margin: 0 auto;
_margin-top: -3px; _margin-top: -3px;
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
} }
@ -25,11 +25,15 @@
margin-top: -1px; margin-top: -1px;
} }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { .leaflet-popup-content-wrapper, .leaflet-popup-tip {
border: 1px solid #bbb; border: 1px solid #999;
}
.leaflet-popup-content-wrapper {
zoom: 1;
} }
.leaflet-control-zoom { .leaflet-control-zoom,
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#3F000000',EndColorStr='#3F000000'); .leaflet-control-layers {
border: 3px solid #999;
} }
.leaflet-control-zoom a { .leaflet-control-zoom a {
background-color: #eee; background-color: #eee;
@ -39,9 +43,15 @@
} }
.leaflet-control-layers-toggle { .leaflet-control-layers-toggle {
} }
.leaflet-control-attribution, .leaflet-control-layers { .leaflet-control-attribution,
.leaflet-control-layers,
.leaflet-control-scale-line {
background: white; background: white;
} }
.leaflet-zoom-box { .leaflet-zoom-box {
filter: alpha(opacity=50); filter: alpha(opacity=50);
} }
.leaflet-control-attribution {
border-top: 1px solid #bbb;
border-left: 1px solid #bbb;
}

File diff suppressed because it is too large Load diff

View file

@ -294,7 +294,7 @@ L.LocationFilter = L.Class.extend({
this._eastRect = this._drawRectangle(this._eastBounds); this._eastRect = this._drawRectangle(this._eastBounds);
this._southRect = this._drawRectangle(this._southBounds); this._southRect = this._drawRectangle(this._southBounds);
this._innerRect = this._drawRectangle(this.getBounds(), { this._innerRect = this._drawRectangle(this.getBounds(), {
fillColor: "transparent", fillOpacity: 0,
stroke: true, stroke: true,
color: "white", color: "white",
weight: 1, weight: 1,

View file

@ -7,21 +7,18 @@ L.Control.Zoomslider = L.Control.extend({
onAdd: function (map) { onAdd: function (map) {
var className = 'leaflet-control-zoomslider', var className = 'leaflet-control-zoomslider',
container = L.DomUtil.create('div', className); container = L.DomUtil.create('div', className);
L.DomEvent.disableClickPropagation(container);
L.DomEvent
.on(container, 'click', L.DomEvent.stopPropagation)
.on(container, 'mousedown', L.DomEvent.stopPropagation)
.on(container, 'dblclick', L.DomEvent.stopPropagation);
this._map = map; this._map = map;
this._zoomInButton = this._createButton('+', 'Zoom in', className + '-in' this._zoomInButton = this._createButton('Zoom in', className + '-in'
, container, this._zoomIn , this); , container, this._zoomIn , this);
this._createSlider(className + '-slider', container, map); this._createSlider(className + '-slider', container, map);
this._zoomOutButton = this._createButton('-', 'Zoom out', className + '-out' this._zoomOutButton = this._createButton('Zoom out', className + '-out'
, container, this._zoomOut, this); , container, this._zoomOut, this);
map.on('layeradd layerremove', this._refresh, this); map.on('layeradd layerremove', this._refresh, this);
map.whenReady(function(){ map.whenReady(function(){
@ -45,6 +42,11 @@ L.Control.Zoomslider = L.Control.extend({
_createSlider: function (className, container, map) { _createSlider: function (className, container, map) {
var zoomLevels = map.getMaxZoom() - map.getMinZoom(); var zoomLevels = map.getMaxZoom() - map.getMinZoom();
// This means we have no tilelayers (or that they are setup in a strange way).
// Either way we don't want to add a slider here.
if(zoomLevels == Infinity){
return undefined;
}
this._sliderHeight = this.options.stepHeight * zoomLevels; this._sliderHeight = this.options.stepHeight * zoomLevels;
var wrapper = L.DomUtil.create('div', className + '-wrap', container); var wrapper = L.DomUtil.create('div', className + '-wrap', container);
@ -68,9 +70,8 @@ L.Control.Zoomslider = L.Control.extend({
this._map.zoomOut(e.shiftKey ? 3 : 1); this._map.zoomOut(e.shiftKey ? 3 : 1);
}, },
_createButton: function (html, title, className, container, fn, context) { _createButton: function (title, className, container, fn, context) {
var link = L.DomUtil.create('a', className, container); var link = L.DomUtil.create('a', className, container);
link.innerHTML = html;
link.href = '#'; link.href = '#';
link.title = title; link.title = title;
@ -82,16 +83,12 @@ L.Control.Zoomslider = L.Control.extend({
}, },
_createDraggable: function() { _createDraggable: function() {
L.DomUtil.setPosition(this._knob, new L.Point(0, 0)); L.DomUtil.setPosition(this._knob, L.point(0, 0));
L.DomEvent L.DomEvent.disableClickPropagation(this._knob);
.on(this._knob
, L.Draggable.START
, L.DomEvent.stopPropagation)
.on(this._knob, 'click', L.DomEvent.stopPropagation);
var bounds = new L.Bounds( var bounds = new L.Bounds(
new L.Point(0, 0), L.point(0, 0),
new L.Point(0, this._sliderHeight) L.point(0, this._sliderHeight)
); );
var draggable = new L.BoundedDraggable(this._knob, var draggable = new L.BoundedDraggable(this._knob,
this._knob, this._knob,
@ -135,7 +132,7 @@ L.Control.Zoomslider = L.Control.extend({
: sliderValue; : sliderValue;
var y = this._sliderHeight var y = this._sliderHeight
- (sliderValue * this.options.stepHeight); - (sliderValue * this.options.stepHeight);
L.DomUtil.setPosition(this._knob, new L.Point(0, y)); L.DomUtil.setPosition(this._knob, L.point(0, y));
} }
}, },
_toZoomLevel: function(sliderValue) { _toZoomLevel: function(sliderValue) {
@ -191,7 +188,7 @@ L.BoundedDraggable = L.Draggable.extend({
}, this); }, this);
}, },
_fitPoint: function(point){ _fitPoint: function(point){
var closest = new L.Point( var closest = L.point(
Math.min(point.x, this._bounds.max.x), Math.min(point.x, this._bounds.max.x),
Math.min(point.y, this._bounds.max.y) Math.min(point.y, this._bounds.max.y)
); );