Menu

#86 CustomSelectionTool.showPopupMenu(..)

open
nobody
None
5
2003-09-21
2003-09-21
No

Hi,
in a zoomed Diagram the Popup's appear at a bad
location.

Therefore the popupMenu Position should be
recalculated if zoomed. The following fix might help.

protected void showPopupMenu(Figure figure, int x, int
y, Component comp) {
Object attribute = figure.getAttribute
(Figure.POPUP_MENU);
if ((attribute != null) && (attribute
instanceof JPopupMenu)) {
JPopupMenu popup =
(JPopupMenu)attribute;
if (popup instanceof
PopupMenuFigureSelection) {

((PopupMenuFigureSelection)
popup).setSelectedFigure(figure);
}
// calculate offsets for
internal MDI frames
//START BUG FIX
=> if zoomed in a ZoomDrawingView
double scale=1.0;
DrawingView v=view();
if (v instanceof
CH.ifa.draw.contrib.zoom.ZoomDrawingView) {
scale=
((CH.ifa.draw.contrib.zoom.ZoomDrawingView)
v).getScale();
}
Point newLocation
= new Point((int)(x*scale),(int)(y*scale));
adjustOffsets
(comp /*.getParent() -> BugFix phirzel*/, newLocation);
//END BUG FIX
popup.setLocation
(newLocation);
popup.setInvoker(comp);
popup.setVisible(true);
}
}

Discussion


Log in to post a comment.