Fix radial menu not always appearing (fixes #492)

This commit is contained in:
John Firebaugh
2013-01-25 12:09:41 -05:00
parent e64c78ae1b
commit dfb38d7d0c
+8 -5
View File
@@ -1,4 +1,6 @@
iD.ui.RadialMenu = function(entity, history, map) {
var arcs;
var radialMenu = function(selection, center) {
var operations,
graph = history.graph(),
@@ -81,7 +83,7 @@ iD.ui.RadialMenu = function(entity, history, map) {
.startAngle(function (d, i) { return 2 * Math.PI / operations.length * i; })
.endAngle(function (d, i) { return 2 * Math.PI / operations.length * (i + 1); });
var arcs = selection.selectAll('.radial-menu')
arcs = selection.selectAll()
.data(operations)
.enter().append('g')
.attr('class', 'radial-menu')
@@ -105,10 +107,11 @@ iD.ui.RadialMenu = function(entity, history, map) {
};
radialMenu.close = function(selection) {
selection.selectAll('.radial-menu')
.transition()
.attr('opacity', 0)
.remove();
if (arcs) {
arcs.transition()
.attr('opacity', 0)
.remove();
}
};
return radialMenu;