Fix walkthrough on Firefox (#1743)

This commit is contained in:
John Firebaugh
2013-08-24 09:08:17 -07:00
parent 12d39c0485
commit 5217f7a34f
4 changed files with 11 additions and 6 deletions

View File

@@ -183,6 +183,13 @@ window.iD = function () {
context.zoomIn = map.zoomIn;
context.zoomOut = map.zoomOut;
context.surfaceRect = function() {
// Work around a bug in Firefox.
// http://stackoverflow.com/questions/18153989/
// https://bugzilla.mozilla.org/show_bug.cgi?id=530985
return context.surface().node().parentNode.getBoundingClientRect();
};
/* Presets */
var presets = iD.presets()
.load(iD.data.presets);

View File

@@ -105,7 +105,7 @@ iD.ui.intro = function(context) {
};
iD.ui.intro.pointBox = function(point, context) {
var rect = context.surface().node().getBoundingClientRect();
var rect = context.surfaceRect();
point = context.projection(point);
return {
left: point[0] + rect.left - 30,
@@ -117,7 +117,7 @@ iD.ui.intro.pointBox = function(point, context) {
iD.ui.intro.pad = function(box, padding, context) {
if (box instanceof Array) {
var rect = context.surface().node().getBoundingClientRect();
var rect = context.surfaceRect();
box = context.projection(box);
box = {
left: box[0] + rect.left,

View File

@@ -23,7 +23,7 @@ iD.ui.intro.navigation = function(context, reveal) {
step.enter = function() {
var rect = context.surface().node().getBoundingClientRect(),
var rect = context.surfaceRect(),
map = {
left: rect.left + 10,
top: rect.top + 70,

View File

@@ -66,9 +66,7 @@ iD.ui.RadialMenu = function(context, operations) {
.attr('class', 'tooltip-inner radial-menu-tooltip');
function mouseover(d, i) {
// Avoid getBoundingClientRect on SVG element; browser implementations
// differ: http://stackoverflow.com/questions/18153989/
var rect = context.surface().node().parentNode.getBoundingClientRect(),
var rect = context.surfaceRect(),
angle = a0 + i * a,
dx = rect.left - (angle < 0 ? 200 : 0),
dy = rect.top;