Skip to content

Commit

Permalink
update website link, update build
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner authored and emartinez-usgs committed Feb 26, 2013
1 parent e70f0a6 commit 076ed21
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ var build = require('./build/build.js'),
lint = require('./build/hint.js');

var COPYRIGHT = '/*\n Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin\n' +
' Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.\n' +
' http://leaflet.cloudmade.com\n*/\n';
' Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.\n' +
' http://leafletjs.com\n*/\n';

desc('Check Leaflet source for errors with JSHint');
task('lint', function () {
Expand Down
50 changes: 38 additions & 12 deletions dist/leaflet-src.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin
Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.
http://leaflet.cloudmade.com
http://leafletjs.com
*/
(function (window, undefined) {

Expand Down Expand Up @@ -4033,7 +4033,7 @@ L.Path.include({

bindPopup: function (content, options) {

if (!this._popup || this._popup.options !== options) {
if (!this._popup || options) {
this._popup = new L.Popup(options, this);
}

Expand All @@ -4042,7 +4042,8 @@ L.Path.include({
if (!this._popupHandlersAdded) {
this
.on('click', this._openPopup, this)
.on('remove', this._closePopup, this);
.on('remove', this.closePopup, this);

this._popupHandlersAdded = true;
}

Expand All @@ -4055,13 +4056,16 @@ L.Path.include({
this
.off('click', this.openPopup)
.off('remove', this.closePopup);

this._popupHandlersAdded = false;
}
return this;
},

openPopup: function (latlng) {

if (this._popup) {
// open the popup from one of the path's points if not specified
latlng = latlng || this._latlng ||
this._latlngs[Math.floor(this._latlngs.length / 2)];

Expand All @@ -4071,13 +4075,16 @@ L.Path.include({
return this;
},

closePopup: function () {
if (this._popup) {
this._popup._close();
}
return this;
},

_openPopup: function (e) {
this._popup.setLatLng(e.latlng);
this._map.openPopup(this._popup);
},

_closePopup: function () {
this._popup._close();
}
});

Expand Down Expand Up @@ -5543,9 +5550,10 @@ L.Draggable = L.Class.extend({
TAP_TOLERANCE: 15
},

initialize: function (element, dragStartTarget) {
initialize: function (element, dragStartTarget, longPress) {
this._element = element;
this._dragStartTarget = dragStartTarget || element;
this._longPress = longPress && !L.Browser.msTouch;
},

enable: function () {
Expand All @@ -5570,13 +5578,15 @@ L.Draggable = L.Class.extend({
((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; }

L.DomEvent.preventDefault(e);
L.DomEvent.stopPropagation(e);

if (L.Draggable._disabled) { return; }

this._simulateClick = true;

if (e.touches && e.touches.length > 1) {
this._simulateClick = false;
clearTimeout(this._longPressTimeout);
return;
}

Expand All @@ -5595,6 +5605,19 @@ L.Draggable = L.Class.extend({
this._startPoint = new L.Point(first.clientX, first.clientY);
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.END, this._onUp, this);
},
Expand Down Expand Up @@ -5637,6 +5660,7 @@ L.Draggable = L.Class.extend({

_onUp: function (e) {
var simulateClickTouch;
clearTimeout(this._longPressTimeout);
if (this._simulateClick && e.changedTouches) {
var first = e.changedTouches[0],
el = first.target,
Expand Down Expand Up @@ -5736,23 +5760,25 @@ L.Map.mergeOptions({
inertiaMaxSpeed: 6000, // px/s
inertiaThreshold: L.Browser.touch ? 32 : 18, // ms

longPress: true,

// TODO refactor, move to CRS
worldCopyJump: true
});

L.Map.Drag = L.Handler.extend({
addHooks: function () {
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({
'dragstart': this._onDragStart,
'drag': this._onDrag,
'dragend': this._onDragEnd
}, this);

var options = this._map.options;

if (options.worldCopyJump) {
this._draggable.on('predrag', this._onPreDrag, this);
this._map.on('viewreset', this._onViewReset, this);
Expand Down Expand Up @@ -7003,7 +7029,7 @@ L.control.zoom = function (options) {
L.Control.Attribution = L.Control.extend({
options: {
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) {
Expand Down
4 changes: 2 additions & 2 deletions dist/leaflet.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/control/Control.Attribution.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
L.Control.Attribution = L.Control.extend({
options: {
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) {
Expand Down

0 comments on commit 076ed21

Please sign in to comment.