Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed May 10, 2012
2 parents dbf507c + 2678acd commit c188756
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
<img src="http://leaflet.cloudmade.com/docs/images/logo.png" alt="Leaflet" />

Leaflet is a modern, lightweight open-source JavaScript library for mobile-friendly interactive maps, developed by [CloudMade](http://cloudmade.com) to form the core of its next generation JavaScript API. Weighting just about 21kb of gzipped JS code, it still has all the [features](http://leaflet.cloudmade.com/features.html) you will ever need for you web mapping needs while providing a fast, smooth, pleasant user experience.
Leaflet is a modern, lightweight open-source JavaScript library for mobile-friendly interactive maps, developed by [CloudMade](http://cloudmade.com) to form the core of its next generation JavaScript API. Weighting just about 21kb of gzipped JS code, it still has all the [features](http://leaflet.cloudmade.com/features.html) you will ever need for your web mapping needs while providing a fast, smooth, pleasant user experience.

It is built from the ground up to work efficiently and smoothly on both desktop and mobile platforms like iOS and Android, utilizing cutting-edge technologies included in HTML5 and CSS3, focusing on usability, performance, small size, [A-grade](http://developer.yahoo.com/yui/articles/gbs/) browser support, flexibility and [easy to use API](http://leaflet.cloudmade.com/reference.html). The OOP-based code of the library is designed to be modular, extensible and very easy to understand.

Expand Down
35 changes: 35 additions & 0 deletions debug/map/geolocation.html
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Leaflet geolocation debug page</title>

<link rel="stylesheet" href="../../dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="../css/screen.css" />

<script src="../leaflet-include.js"></script>
</head>
<body>

<div id="map"></div>

<script type="text/javascript">

var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});

var map = new L.Map('map', {zoom: 15, layers: [cloudmade]});

function logEvent(e) { console.log(e.type); }
map.on('locationerror', logEvent);
map.on('locationfound', logEvent);

map.locate({setView: true});

</script>
</body>
</html>
11 changes: 8 additions & 3 deletions src/control/Control.js
Expand Up @@ -13,11 +13,16 @@ L.Control = L.Class.extend({
},

setPosition: function (position) {
var map = this._map;

if (map) {
map.removeControl(this);
}

this.options.position = position;

if (this._map) {
this._map.removeControl(this);
this._map.addControl(this);
if (map) {
map.addControl(this);
}
},

Expand Down
2 changes: 1 addition & 1 deletion src/core/Util.js
Expand Up @@ -17,7 +17,7 @@ L.Util = {
},

bind: function (fn, obj) { // (Function, Object) -> Function
var args = Array.prototype.slice.call(arguments, 2);
var args = arguments.length > 2 ? Array.prototype.slice.call(arguments, 2) : null;
return function () {
return fn.apply(obj, args || arguments);
};
Expand Down
8 changes: 7 additions & 1 deletion src/dom/DomUtil.js
Expand Up @@ -33,6 +33,12 @@ L.DomUtil = {
L.DomUtil.getStyle(el, 'position') === 'absolute') {
break;
}
if (L.DomUtil.getStyle(el, 'position') === 'fixed') {
top += docBody.scrollTop || 0;
left += docBody.scrollLeft || 0;
break;
}

el = el.offsetParent;
} while (el);

Expand Down Expand Up @@ -98,7 +104,7 @@ L.DomUtil = {

setOpacity: function (el, value) {
if (L.Browser.ie) {
el.style.filter = 'alpha(opacity=' + Math.round(value * 100) + ')';
el.style.filter += value !== 1 ? 'alpha(opacity=' + Math.round(value * 100) + ')' : '';
} else {
el.style.opacity = value;
}
Expand Down
11 changes: 11 additions & 0 deletions src/layer/tile/TileLayer.js
Expand Up @@ -18,6 +18,7 @@ L.TileLayer = L.Class.extend({
noWrap: false,
zoomOffset: 0,
zoomReverse: false,
detectRetina: false,

unloadInvisibleTiles: L.Browser.mobile,
updateWhenIdle: L.Browser.mobile,
Expand All @@ -27,6 +28,16 @@ L.TileLayer = L.Class.extend({
initialize: function (url, options) {
L.Util.setOptions(this, options);

// detecting retina displays, adjusting tileSize and zoom levels
if (this.options.detectRetina && window.devicePixelRatio > 1 && this.options.maxZoom > 0) {
this.options.tileSize = Math.floor(this.options.tileSize / 2);
this.options.zoomOffset++;
if (this.options.minZoom > 0) {
this.options.minZoom--;
}
this.options.maxZoom--;
}

this._url = url;

var subdomains = this.options.subdomains;
Expand Down
11 changes: 11 additions & 0 deletions src/layer/vector/Circle.js
Expand Up @@ -45,6 +45,10 @@ L.Circle = L.Path.extend({

return new L.LatLngBounds(sw, ne);
},

getLatLng: function () {
return this._latlng;
},

getPathString: function () {
var p = this._point,
Expand All @@ -64,6 +68,10 @@ L.Circle = L.Path.extend({
return "AL " + p.x + "," + p.y + " " + r + "," + r + " 0," + (65535 * 360);
}
},

getRadius: function () {
return this._mRadius;
},

_getLngRadius: function () {
var equatorLength = 40075017,
Expand All @@ -73,6 +81,9 @@ L.Circle = L.Path.extend({
},

_checkIfEmpty: function () {
if (!this._map) {
return false;
}
var vp = this._map._pathViewport,
r = this._radius,
p = this._point;
Expand Down
2 changes: 1 addition & 1 deletion src/layer/vector/Path.SVG.js
Expand Up @@ -69,7 +69,7 @@ L.Path = L.Path.extend({
// TODO remove duplication with L.Map
_initEvents: function () {
if (this.options.clickable) {
if (!L.Browser.vml) {
if (L.Browser.svg || !L.Browser.vml) {
this._path.setAttribute('class', 'leaflet-clickable');
}

Expand Down
2 changes: 1 addition & 1 deletion src/layer/vector/Polyline.js
Expand Up @@ -90,7 +90,7 @@ L.Polyline = L.Path.extend({
onAdd: function (map) {
L.Path.prototype.onAdd.call(this, map);

if (this.editing.enabled()) {
if (this.editing && this.editing.enabled()) {
this.editing.addHooks();
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/map/Map.js
Expand Up @@ -322,6 +322,10 @@ L.Map = L.Class.extend({
getPanes: function () {
return this._panes;
},

getContainer: function () {
return this._container;
},


// conversion methods
Expand Down

0 comments on commit c188756

Please sign in to comment.