Skip to content

Commit

Permalink
Changed the code for singlerightclick again and made it faster.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfpil committed Feb 2, 2010
1 parent 85130a9 commit 0441c4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions 1.0/src/contextmenucontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,27 @@ ContextMenuControl.prototype.initialize = function (map) {
// Displays our context menu on single right mouse click
GEvent.addListener(map, "singlerightclick", function (pixelPoint, src, ov) {
var d = me.dirmarks_;
me.rej_ = null;
if (d.length > 0) {
// Right click on a marker
if (ov instanceof GMarker) {
for (var i = 0; i < d.length; i++) {
// If it's a dir marker it should be removable
if (ov.getLatLng().equals(d[i].getLatLng())) {
me.rej_ = ov.getLatLng();
me.rebuildMenu_("remove");
break;
} else {
me.rebuildMenu_("add");
}
}
if (me.rej_) {
me.rebuildMenu_("remove");
} else {
me.rebuildMenu_("add");
}
} else {
me.rebuildMenu_("add");
}
}
} else {
me.rebuildMenu_();
me.rebuildMenu_();
}

me.clickedPoint_ = map.fromContainerPixelToLatLng(pixelPoint);
Expand Down
Loading

0 comments on commit 0441c4a

Please sign in to comment.