Permalink
Browse files

Blegh.

  • Loading branch information...
Tom MacWright
Tom MacWright committed May 24, 2011
1 parent 9e6a870 commit 41934aa2e55f2dfe389995391ef2c83acf27fae4
Showing with 65 additions and 7 deletions.
  1. +20 −0 build/wax.g.js
  2. +1 −1 build/wax.g.min.js
  3. +22 −4 build/wax.mm.js
  4. +1 −1 build/wax.mm.min.js
  5. +20 −0 build/wax.ol.js
  6. +1 −1 build/wax.ol.min.js
View
@@ -566,6 +566,26 @@ wax.util = {
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
+ },
+
+ // From quirksmode
+ eventoffset: function(e) {
+ var posx = 0;
+ var posy = 0;
+ if (!e) var e = window.event;
+ if (e.pageX || e.pageY) {
+ return {
+ x: e.pageX,
+ y: e.pageY
+ }
+ } else if (e.clientX || e.clientY) {
+ return {
+ x: e.clientX + document.body.scrollLeft
+ + document.documentElement.scrollLeft,
+ y: e.clientY + document.body.scrollTop
+ + document.documentElement.scrollTop
+ }
+ }
}
};
// Wax for Google Maps API v3
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -572,6 +572,26 @@ wax.util = {
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
+ },
+
+ // From quirksmode
+ eventoffset: function(e) {
+ var posx = 0;
+ var posy = 0;
+ if (!e) var e = window.event;
+ if (e.pageX || e.pageY) {
+ return {
+ x: e.pageX,
+ y: e.pageY
+ }
+ } else if (e.clientX || e.clientY) {
+ return {
+ x: e.clientX + document.body.scrollLeft
+ + document.documentElement.scrollLeft,
+ y: e.clientY + document.body.scrollTop
+ + document.documentElement.scrollTop
+ }
+ }
}
};
// Wax: Box Selector
@@ -1100,10 +1120,9 @@ wax.pointselector = function(map, opts) {
// Create a `com.modestmaps.Point` from a screen event, like a click.
var makePoint = function(e) {
- var point = new MM.Point(e.clientX, e.clientY);
+ var coords = wax.util.eventoffset(e);
+ var point = new MM.Point(coords.x, coords.y);
// correct for scrolled document
- point.x += document.body.scrollLeft + document.documentElement.scrollLeft;
- point.y += document.body.scrollTop + document.documentElement.scrollTop;
// and for the document
point.x -= parseFloat(MM.getStyle(document.documentElement, 'margin-left'));
@@ -1164,7 +1183,6 @@ wax.pointselector = function(map, opts) {
}
},
mouseDown: function(e) {
- alert(e);
mouseDownPoint = makePoint(e);
MM.addEvent(map.parent, 'mouseup', pointselector.mouseUp);
},
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -566,6 +566,26 @@ wax.util = {
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
+ },
+
+ // From quirksmode
+ eventoffset: function(e) {
+ var posx = 0;
+ var posy = 0;
+ if (!e) var e = window.event;
+ if (e.pageX || e.pageY) {
+ return {
+ x: e.pageX,
+ y: e.pageY
+ }
+ } else if (e.clientX || e.clientY) {
+ return {
+ x: e.clientX + document.body.scrollLeft
+ + document.documentElement.scrollLeft,
+ y: e.clientY + document.body.scrollTop
+ + document.documentElement.scrollTop
+ }
+ }
}
};
// Wax header
View

Large diffs are not rendered by default.

Oops, something went wrong.

0 comments on commit 41934aa

Please sign in to comment.