update website link, update build

This commit is contained in:
Vladimir Agafonkin 2012-11-02 15:16:17 +02:00
parent 37712769bf
commit 4080a64adc
4 changed files with 43 additions and 17 deletions

View File

@ -2,8 +2,8 @@ var build = require('./build/build.js'),
lint = require('./build/hint.js'); lint = require('./build/hint.js');
var COPYRIGHT = '/*\n Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin\n' + var COPYRIGHT = '/*\n Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin\n' +
' Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.\n' + ' Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.\n' +
' http://leaflet.cloudmade.com\n*/\n'; ' http://leafletjs.com\n*/\n';
desc('Check Leaflet source for errors with JSHint'); desc('Check Leaflet source for errors with JSHint');
task('lint', function () { task('lint', function () {

50
dist/leaflet-src.js vendored
View File

@ -1,7 +1,7 @@
/* /*
Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin
Leaflet is an open-source JavaScript library for mobile-friendly interactive maps. Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.
http://leaflet.cloudmade.com http://leafletjs.com
*/ */
(function (window, undefined) { (function (window, undefined) {
@ -4033,7 +4033,7 @@ L.Path.include({
bindPopup: function (content, options) { bindPopup: function (content, options) {
if (!this._popup || this._popup.options !== options) { if (!this._popup || options) {
this._popup = new L.Popup(options, this); this._popup = new L.Popup(options, this);
} }
@ -4042,7 +4042,8 @@ L.Path.include({
if (!this._popupHandlersAdded) { if (!this._popupHandlersAdded) {
this this
.on('click', this._openPopup, this) .on('click', this._openPopup, this)
.on('remove', this._closePopup, this); .on('remove', this.closePopup, this);
this._popupHandlersAdded = true; this._popupHandlersAdded = true;
} }
@ -4055,6 +4056,8 @@ L.Path.include({
this this
.off('click', this.openPopup) .off('click', this.openPopup)
.off('remove', this.closePopup); .off('remove', this.closePopup);
this._popupHandlersAdded = false;
} }
return this; return this;
}, },
@ -4062,6 +4065,7 @@ L.Path.include({
openPopup: function (latlng) { openPopup: function (latlng) {
if (this._popup) { if (this._popup) {
// open the popup from one of the path's points if not specified
latlng = latlng || this._latlng || latlng = latlng || this._latlng ||
this._latlngs[Math.floor(this._latlngs.length / 2)]; this._latlngs[Math.floor(this._latlngs.length / 2)];
@ -4071,13 +4075,16 @@ L.Path.include({
return this; return this;
}, },
closePopup: function () {
if (this._popup) {
this._popup._close();
}
return this;
},
_openPopup: function (e) { _openPopup: function (e) {
this._popup.setLatLng(e.latlng); this._popup.setLatLng(e.latlng);
this._map.openPopup(this._popup); this._map.openPopup(this._popup);
},
_closePopup: function () {
this._popup._close();
} }
}); });
@ -5543,9 +5550,10 @@ L.Draggable = L.Class.extend({
TAP_TOLERANCE: 15 TAP_TOLERANCE: 15
}, },
initialize: function (element, dragStartTarget) { initialize: function (element, dragStartTarget, longPress) {
this._element = element; this._element = element;
this._dragStartTarget = dragStartTarget || element; this._dragStartTarget = dragStartTarget || element;
this._longPress = longPress && !L.Browser.msTouch;
}, },
enable: function () { enable: function () {
@ -5570,6 +5578,7 @@ L.Draggable = L.Class.extend({
((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; } ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; }
L.DomEvent.preventDefault(e); L.DomEvent.preventDefault(e);
L.DomEvent.stopPropagation(e);
if (L.Draggable._disabled) { return; } if (L.Draggable._disabled) { return; }
@ -5577,6 +5586,7 @@ L.Draggable = L.Class.extend({
if (e.touches && e.touches.length > 1) { if (e.touches && e.touches.length > 1) {
this._simulateClick = false; this._simulateClick = false;
clearTimeout(this._longPressTimeout);
return; return;
} }
@ -5595,6 +5605,19 @@ L.Draggable = L.Class.extend({
this._startPoint = new L.Point(first.clientX, first.clientY); this._startPoint = new L.Point(first.clientX, first.clientY);
this._startPos = this._newPos = L.DomUtil.getPosition(this._element); this._startPos = this._newPos = L.DomUtil.getPosition(this._element);
//Touch contextmenu event emulation
if (e.touches && e.touches.length === 1 && L.Browser.touch && this._longPress) {
this._longPressTimeout = setTimeout(L.Util.bind(function () {
var dist = (this._newPos && this._newPos.distanceTo(this._startPos)) || 0;
if (dist < L.Draggable.TAP_TOLERANCE) {
this._simulateClick = false;
this._onUp();
this._simulateEvent('contextmenu', first);
}
}, this), 1000);
}
L.DomEvent.on(document, L.Draggable.MOVE, this._onMove, this); L.DomEvent.on(document, L.Draggable.MOVE, this._onMove, this);
L.DomEvent.on(document, L.Draggable.END, this._onUp, this); L.DomEvent.on(document, L.Draggable.END, this._onUp, this);
}, },
@ -5637,6 +5660,7 @@ L.Draggable = L.Class.extend({
_onUp: function (e) { _onUp: function (e) {
var simulateClickTouch; var simulateClickTouch;
clearTimeout(this._longPressTimeout);
if (this._simulateClick && e.changedTouches) { if (this._simulateClick && e.changedTouches) {
var first = e.changedTouches[0], var first = e.changedTouches[0],
el = first.target, el = first.target,
@ -5736,6 +5760,8 @@ L.Map.mergeOptions({
inertiaMaxSpeed: 6000, // px/s inertiaMaxSpeed: 6000, // px/s
inertiaThreshold: L.Browser.touch ? 32 : 18, // ms inertiaThreshold: L.Browser.touch ? 32 : 18, // ms
longPress: true,
// TODO refactor, move to CRS // TODO refactor, move to CRS
worldCopyJump: true worldCopyJump: true
}); });
@ -5743,7 +5769,9 @@ L.Map.mergeOptions({
L.Map.Drag = L.Handler.extend({ L.Map.Drag = L.Handler.extend({
addHooks: function () { addHooks: function () {
if (!this._draggable) { if (!this._draggable) {
this._draggable = new L.Draggable(this._map._mapPane, this._map._container); var options = this._map.options;
this._draggable = new L.Draggable(this._map._mapPane, this._map._container, options.longPress);
this._draggable.on({ this._draggable.on({
'dragstart': this._onDragStart, 'dragstart': this._onDragStart,
@ -5751,8 +5779,6 @@ L.Map.Drag = L.Handler.extend({
'dragend': this._onDragEnd 'dragend': this._onDragEnd
}, this); }, this);
var options = this._map.options;
if (options.worldCopyJump) { if (options.worldCopyJump) {
this._draggable.on('predrag', this._onPreDrag, this); this._draggable.on('predrag', this._onPreDrag, this);
this._map.on('viewreset', this._onViewReset, this); this._map.on('viewreset', this._onViewReset, this);
@ -7003,7 +7029,7 @@ L.control.zoom = function (options) {
L.Control.Attribution = L.Control.extend({ L.Control.Attribution = L.Control.extend({
options: { options: {
position: 'bottomright', position: 'bottomright',
prefix: 'Powered by <a href="http://leaflet.cloudmade.com">Leaflet</a>' prefix: 'Powered by <a href="http://leafletjs.com">Leaflet</a>'
}, },
initialize: function (options) { initialize: function (options) {

4
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
L.Control.Attribution = L.Control.extend({ L.Control.Attribution = L.Control.extend({
options: { options: {
position: 'bottomright', position: 'bottomright',
prefix: 'Powered by <a href="http://leaflet.cloudmade.com">Leaflet</a>' prefix: 'Powered by <a href="http://leafletjs.com">Leaflet</a>'
}, },
initialize: function (options) { initialize: function (options) {