Merge remote-tracking branch 'upstream/master' into fire_edit_on_drag_vertex

This commit is contained in:
jpk 2012-02-22 20:09:46 -05:00
commit 62f3b6faeb
5 changed files with 27 additions and 5 deletions

View File

@ -7,16 +7,18 @@ Leaflet Changelog
An in-progress version being developed on the master branch. An in-progress version being developed on the master branch.
### Major features ### Notable new features
* Added **polyline and polygon editing**. [#174](https://github.com/CloudMade/Leaflet/issues/174) * Added **polyline and polygon editing**. [#174](https://github.com/CloudMade/Leaflet/issues/174)
* Added `DivIcon` class that easily allows you to create lightweight div-based markers. * Added `DivIcon` class that easily allows you to create lightweight div-based markers.
* Added `Rectangle` vector layer (by [@JasonSanford](https://github.com/JasonSanford)). [#504](https://github.com/CloudMade/Leaflet/pull/504)
### Improvements ### Improvements
#### Usabiliy improvements #### Usabiliy improvements
* Drag-panning now works even when there are markers in the starting point (helps on maps with lots of markers). [#506](https://github.com/CloudMade/Leaflet/issues/506) * Drag-panning now works even when there are markers in the starting point (helps on maps with lots of markers). [#506](https://github.com/CloudMade/Leaflet/issues/506)
* Improved panning performance even more (there are no wasted frames now).
* Slightly improved default popup styling. * Slightly improved default popup styling.
#### Breaking API changes #### Breaking API changes
@ -33,6 +35,7 @@ An in-progress version being developed on the master branch.
* Added `Icon` `className` option to assign a custom class to an icon. * Added `Icon` `className` option to assign a custom class to an icon.
* Added `Icon` `shadowOffset` option to set the position of shadow relative to the icon. * Added `Icon` `shadowOffset` option to set the position of shadow relative to the icon.
* Made all `Icon` options except `iconUrl` optional (if not specified, they'll be chosen automatically or implemented using CSS). Anchor is centered by default (if size is specified), and otherwise can be set through CSS using negative margins. * Made all `Icon` options except `iconUrl` optional (if not specified, they'll be chosen automatically or implemented using CSS). Anchor is centered by default (if size is specified), and otherwise can be set through CSS using negative margins.
* Added `originalEvent` property to `MouseEvent` (by [@k4](https://github.com/k4)). [#521](https://github.com/CloudMade/Leaflet/pull/521)
* Added `Circle` `getBounds` method. [#440](https://github.com/CloudMade/Leaflet/issues/440) * Added `Circle` `getBounds` method. [#440](https://github.com/CloudMade/Leaflet/issues/440)
* Added `Marker` `opacity` option. * Added `Marker` `opacity` option.
* Added public `redraw` method to vector layers (useful if you manipulate their `LatLng` points directly). * Added public `redraw` method to vector layers (useful if you manipulate their `LatLng` points directly).

View File

@ -30,6 +30,9 @@ L.Util = {
}; };
}()), }()),
// TODO refactor: remove repetition
requestAnimFrame: (function () { requestAnimFrame: (function () {
function timeoutDefer(callback) { function timeoutDefer(callback) {
window.setTimeout(callback, 1000 / 60); window.setTimeout(callback, 1000 / 60);
@ -47,11 +50,24 @@ L.Util = {
if (immediate && requestFn === timeoutDefer) { if (immediate && requestFn === timeoutDefer) {
callback(); callback();
} else { } else {
requestFn(callback, contextEl); return requestFn.call(window, callback, contextEl);
} }
}; };
}()), }()),
cancelAnimFrame: (function () {
var requestFn = window.cancelAnimationFrame ||
window.webkitCancelRequestAnimationFrame ||
window.mozCancelRequestAnimationFrame ||
window.oCancelRequestAnimationFrame ||
window.msCancelRequestAnimationFrame ||
clearTimeout;
return function (handle) {
return requestFn.call(window, handle);
}
}()),
limitExecByInterval: function (fn, time, context) { limitExecByInterval: function (fn, time, context) {
var lock, execOnUnlock, args; var lock, execOnUnlock, args;
function exec() { function exec() {

View File

@ -90,7 +90,8 @@ L.Draggable = L.Class.extend({
var newPoint = new L.Point(first.clientX, first.clientY); var newPoint = new L.Point(first.clientX, first.clientY);
this._newPos = this._startPos.add(newPoint).subtract(this._startPoint); this._newPos = this._startPos.add(newPoint).subtract(this._startPoint);
L.Util.requestAnimFrame(this._updatePosition, this, true, this._dragStartTarget); L.Util.cancelAnimFrame(this._animRequest);
this._animRequest = L.Util.requestAnimFrame(this._updatePosition, this, true, this._dragStartTarget);
}, },
_updatePosition: function () { _updatePosition: function () {

View File

@ -106,7 +106,8 @@ L.Path = L.Path.extend({
this.fire(e.type, { this.fire(e.type, {
latlng: latlng, latlng: latlng,
layerPoint: layerPoint, layerPoint: layerPoint,
containerPoint: containerPoint containerPoint: containerPoint,
originalEvent: e
}); });
L.DomEvent.stopPropagation(e); L.DomEvent.stopPropagation(e);

View File

@ -597,7 +597,8 @@ L.Map = L.Class.extend({
this.fire(type, { this.fire(type, {
latlng: latlng, latlng: latlng,
layerPoint: layerPoint, layerPoint: layerPoint,
containerPoint: containerPoint containerPoint: containerPoint,
originalEvent: e
}); });
}, },