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 '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.ie.css', 'dist/leaflet.ie.css'
file 'leaflet.js', 'dist/leaflet-src.js'
folder 'images', 'dist/images'
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.js', 'src/locationfilter.js'
folder 'img', 'src/img'
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'
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'
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'
end
end

View file

@ -1,5 +1,5 @@
// Leaflet extensions
L.LatLngBounds.include({
L.extend(L.LatLngBounds.prototype, {
getSouthLat: function () {
return this._southWest.lat;
},
@ -32,7 +32,7 @@ L.LatLngBounds.include({
}
});
L.Bounds.include({
L.extend(L.Bounds.prototype, {
getWidth: function () {
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 {
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
@ -187,22 +188,58 @@
}
/* 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 */
.leaflet-control-zoom {
-webkit-border-radius: 7px;
border-radius: 7px;
}
.leaflet-control-zoom {
padding: 5px;
background: rgba(0, 0, 0, 0.25);
.leaflet-container .leaflet-control-zoom {
margin-left: 13px;
margin-top: 12px;
}
.leaflet-control-zoom a {
width: 19px;
height: 19px;
background-color: rgba(255, 255, 255, 0.75);
-webkit-border-radius: 4px;
border-radius: 4px;
width: 22px;
height: 22px;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-control-zoom a,
.leaflet-control-layers-toggle {
@ -212,24 +249,37 @@
}
.leaflet-control-zoom a:hover {
background-color: #fff;
}
.leaflet-touch .leaflet-control-zoom a {
width: 27px;
height: 27px;
color: #777;
}
.leaflet-control-zoom-in {
background-image: url(images/zoom-in.png);
margin-bottom: 5px;
font: bold 18px/24px Arial, Helvetica, sans-serif;
}
.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 */
.leaflet-control-layers {
box-shadow: 0 1px 7px #999;
box-shadow: 0 1px 7px rgba(0,0,0,0.4);
background: #f8f8f9;
-webkit-border-radius: 8px;
border-radius: 8px;
@ -297,27 +347,33 @@
border: 2px solid #777;
border-top: none;
color: black;
line-height: 1;
font-size: 10px;
padding-bottom: 2px;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
text-shadow: 1px 1px 1px #fff;
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) {
border-top: 2px solid #777;
padding-top: 1px;
border-bottom: none;
margin-top: -2px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
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;
}
.leaflet-touch .leaflet-control-layers {
border: 5px solid #bbb;
.leaflet-touch .leaflet-control-layers,
.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 {
background: white;
box-shadow: 0 3px 14px rgba(0,0,0,0.35);
-webkit-box-shadow: 0 3px 18px rgba(0,0,0,0.33);
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
@ -378,6 +433,7 @@
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;

View file

@ -25,11 +25,15 @@
margin-top: -1px;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
border: 1px solid #bbb;
border: 1px solid #999;
}
.leaflet-popup-content-wrapper {
zoom: 1;
}
.leaflet-control-zoom {
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#3F000000',EndColorStr='#3F000000');
.leaflet-control-zoom,
.leaflet-control-layers {
border: 3px solid #999;
}
.leaflet-control-zoom a {
background-color: #eee;
@ -39,9 +43,15 @@
}
.leaflet-control-layers-toggle {
}
.leaflet-control-attribution, .leaflet-control-layers {
.leaflet-control-attribution,
.leaflet-control-layers,
.leaflet-control-scale-line {
background: white;
}
.leaflet-zoom-box {
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._southRect = this._drawRectangle(this._southBounds);
this._innerRect = this._drawRectangle(this.getBounds(), {
fillColor: "transparent",
fillOpacity: 0,
stroke: true,
color: "white",
weight: 1,

View file

@ -9,17 +9,14 @@ L.Control.Zoomslider = L.Control.extend({
var className = 'leaflet-control-zoomslider',
container = L.DomUtil.create('div', className);
L.DomEvent
.on(container, 'click', L.DomEvent.stopPropagation)
.on(container, 'mousedown', L.DomEvent.stopPropagation)
.on(container, 'dblclick', L.DomEvent.stopPropagation);
L.DomEvent.disableClickPropagation(container);
this._map = map;
this._zoomInButton = this._createButton('+', 'Zoom in', className + '-in'
this._zoomInButton = this._createButton('Zoom in', className + '-in'
, container, this._zoomIn , this);
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);
map.on('layeradd layerremove', this._refresh, this);
@ -45,6 +42,11 @@ L.Control.Zoomslider = L.Control.extend({
_createSlider: function (className, container, map) {
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;
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);
},
_createButton: function (html, title, className, container, fn, context) {
_createButton: function (title, className, container, fn, context) {
var link = L.DomUtil.create('a', className, container);
link.innerHTML = html;
link.href = '#';
link.title = title;
@ -82,16 +83,12 @@ L.Control.Zoomslider = L.Control.extend({
},
_createDraggable: function() {
L.DomUtil.setPosition(this._knob, new L.Point(0, 0));
L.DomEvent
.on(this._knob
, L.Draggable.START
, L.DomEvent.stopPropagation)
.on(this._knob, 'click', L.DomEvent.stopPropagation);
L.DomUtil.setPosition(this._knob, L.point(0, 0));
L.DomEvent.disableClickPropagation(this._knob);
var bounds = new L.Bounds(
new L.Point(0, 0),
new L.Point(0, this._sliderHeight)
L.point(0, 0),
L.point(0, this._sliderHeight)
);
var draggable = new L.BoundedDraggable(this._knob,
this._knob,
@ -135,7 +132,7 @@ L.Control.Zoomslider = L.Control.extend({
: sliderValue;
var y = this._sliderHeight
- (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) {
@ -191,7 +188,7 @@ L.BoundedDraggable = L.Draggable.extend({
}, this);
},
_fitPoint: function(point){
var closest = new L.Point(
var closest = L.point(
Math.min(point.x, this._bounds.max.x),
Math.min(point.y, this._bounds.max.y)
);