Fix radial menu tooltip positioning

This commit is contained in:
John Firebaugh
2013-08-07 11:42:11 -07:00
parent 172898bec2
commit 18829ee482
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -156,7 +156,7 @@ iD.modes.Select = function(context, selectedIDs) {
context.map().on('drawn.select', selectElements);
selectElements();
radialMenu = iD.ui.RadialMenu(operations);
radialMenu = iD.ui.RadialMenu(context, operations);
var show = d3.event && !suppressMenu;
if (show) {
+5 -4
View File
@@ -1,4 +1,4 @@
iD.ui.RadialMenu = function(operations) {
iD.ui.RadialMenu = function(context, operations) {
var menu,
center = [0, 0],
tooltip;
@@ -66,9 +66,10 @@ iD.ui.RadialMenu = function(operations) {
.attr('class', 'tooltip-inner radial-menu-tooltip');
function mouseover(d, i) {
var angle = a0 + i * a,
dx = angle < 0 ? -200 : 0,
dy = 0;
var rect = context.surface().node().getBoundingClientRect(),
angle = a0 + i * a,
dx = rect.left - (angle < 0 ? 200 : 0),
dy = rect.top;
tooltip
.style('left', (r + 25) * Math.sin(angle) + dx + center[0] + 'px')