Skip to content
Browse files

Merge branch 'release/1.2.2'

  • Loading branch information...
2 parents 460e98c + 5006e8e commit 0a0575b3de25a03d45689c1f369998fc37175531 @bjornd committed Jan 20, 2013
Showing with 16 additions and 5 deletions.
  1. +1 −1 converter/converter.py
  2. +1 −1 jquery-jvectormap.js
  3. +1 −1 jvectormap.jquery.json
  4. +12 −2 lib/world-map.js
  5. +1 −0 tests/index.html
View
2 converter/converter.py
@@ -1,5 +1,5 @@
#
-# jVectorMap version 1.2.1
+# jVectorMap version 1.2.2
#
# Copyright 2011-2013, Kirill Lebedev
# Licensed under the MIT license.
View
2 jquery-jvectormap.js
@@ -1,5 +1,5 @@
/**
- * jVectorMap version 1.2.1
+ * jVectorMap version 1.2.2
*
* Copyright 2011-2013, Kirill Lebedev
* Licensed under the MIT license.
View
2 jvectormap.jquery.json
@@ -9,7 +9,7 @@
"usa",
"choropleth"
],
- "version": "1.2.1",
+ "version": "1.2.2",
"author": {
"name": "Kirill Lebedev",
"email" : "echo.bjornd@gmail.com"
View
14 lib/world-map.js
@@ -309,19 +309,26 @@ jvm.WorldMap.prototype = {
lastTouchesLength,
handleTouchEvent = function(e){
var touches = e.originalEvent.touches,
- scale;
+ offset,
+ scale,
+ transXOld,
+ transYOld;
if (e.type == 'touchstart') {
lastTouchesLength = 0;
}
if (touches.length == 1) {
if (lastTouchesLength == 1) {
+ transXOld = map.transX;
+ transYOld = map.transY;
map.transX -= (touchX - touches[0].pageX) / map.scale;
map.transY -= (touchY - touches[0].pageY) / map.scale;
map.applyTransform();
map.label.hide();
- e.preventDefault();
+ if (transXOld != map.transX || transYOld != map.transY) {
+ e.preventDefault();
+ }
}
touchX = touches[0].pageX;
touchY = touches[0].pageY;
@@ -339,6 +346,7 @@ jvm.WorldMap.prototype = {
map.label.hide();
e.preventDefault();
} else {
+ offset = jvm.$(map.container).offset();
if (touches[0].pageX > touches[1].pageX) {
centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2;
} else {
@@ -349,6 +357,8 @@ jvm.WorldMap.prototype = {
} else {
centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2;
}
+ centerTouchX -= offset.left;
+ centerTouchY -= offset.top;
touchStartScale = map.scale;
touchStartDistance = Math.sqrt(
Math.pow(touches[0].pageX - touches[1].pageX, 2) +
View
1 tests/index.html
@@ -253,6 +253,7 @@
</script>
</head>
<body>
+ <div style="height: 400px"></div>
<div id="map1" style="width: 600px; height: 400px"></div>
<button id="focus-single">Focus on Australia</button>
<button id="focus-multiple">Focus on Australia and Japan</button>

0 comments on commit 0a0575b

Please sign in to comment.
Something went wrong with that request. Please try again.