Comparing version 2.0.6 to 2.0.7
@@ -6,3 +6,3 @@ var map; | ||
var dmap = document.getElementById('map'); | ||
wax.tilejson('http://a.tiles.mapbox.com/v3/mapbox.mapbox-streets.jsonp', | ||
wax.tilejson('http://a.tiles.mapbox.com/v3/examples.map-vyofok3q.jsonp', | ||
function(tj) { | ||
@@ -9,0 +9,0 @@ map = new com.modestmaps.Map(dmap, |
{ | ||
"name": "easey", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Easing for Modest Maps", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -13,2 +13,4 @@ ;(function(context, MM) { | ||
locations = {}, | ||
scale = 1, | ||
startDistance = 1, | ||
taps = [], | ||
@@ -25,2 +27,5 @@ wasPinching = false, | ||
function clearLocations() { | ||
scale = 1; | ||
startDistance = 1; | ||
for (var loc in locations) { | ||
@@ -34,2 +39,4 @@ if (locations.hasOwnProperty(loc)) { | ||
function updateTouches (e) { | ||
var eventScale = (e.scale === undefined) ? scale : e.scale; | ||
for (var i = 0; i < e.touches.length; i += 1) { | ||
@@ -41,7 +48,7 @@ var t = e.touches[i]; | ||
l.y = t.clientY; | ||
l.scale = e.scale; | ||
l.scale = eventScale; | ||
} else { | ||
locations[t.identifier] = { | ||
scale: e.scale, | ||
startPos: { x: t.clientX, y: t.screenY }, | ||
scale: eventScale, | ||
startPos: { x: t.clientX, y: t.clientY }, | ||
startZoom: map.zoom(), | ||
@@ -67,2 +74,15 @@ x: t.clientX, | ||
touchEndMachine); | ||
if (e.scale === undefined) { | ||
var _t0 = e.touches[0], | ||
_t1 = e.touches[1], | ||
_p0 = new MM.Point(0, 0), | ||
_p1 = new MM.Point(0, 0); | ||
_p0.x = _t0.clientX; | ||
_p0.y = _t0.clientY; | ||
_p1.x = _t1.clientX; | ||
_p1.y = _t1.clientY; | ||
startDistance = MM.Point.distance(_p0, _p1); | ||
} | ||
} | ||
@@ -118,3 +138,3 @@ updateTouches(e); | ||
p1.y = t1.clientY; | ||
l0 = locations[t0.identifier], | ||
l0 = locations[t0.identifier]; | ||
l1 = locations[t1.identifier]; | ||
@@ -129,4 +149,7 @@ | ||
// e.scale isn't available to Android or Windows 7 browsers | ||
var eventScale = (e.scale === undefined) ? scale = MM.Point.distance(p0, p1) / startDistance : e.scale; | ||
map.zoomByAbout( | ||
Math.log(e.scale) / Math.LN2 - Math.log(l0.scale) / Math.LN2, | ||
Math.log(eventScale) / Math.LN2 - Math.log(l0.scale) / Math.LN2, | ||
center); | ||
@@ -147,2 +170,3 @@ | ||
tz = locations[touch.identifier].startZoom > z ? Math.floor(z) : Math.ceil(z); | ||
easey().map(map).point(lastPinchCenter).zoom(tz) | ||
@@ -162,3 +186,3 @@ .path('about').run(300); | ||
// round zoom if we're done pinching | ||
if (e.touches.length === 0 && wasPinching) { | ||
if (e.touches.length <= 1 && wasPinching) { | ||
onPinched(e.changedTouches[0]); | ||
@@ -165,0 +189,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
466503
10092