| Summary: | ImageFigure not working correctly with border and local coordinates | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Jason Grant <junk> |
| Component: | GEF-Legacy Draw2d | Assignee: | Alexander Nyßen <nyssen> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | nyssen |
| Version: | 3.2 | ||
| Target Milestone: | 3.6.2 (Helios SR2) | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Jason Grant
Changed that within paintFigure, bounds that are shrinked/cropped by insets are used rather than client area. Because Rectangle#getCropped() was deprecated in 3.7 (replaced by getShrinked(), which was introduced in 3.7), used different fixes in both versions. In the 3.6 maintenance branch, changed calculation of area to: Rectangle area = getBounds().getCropped(getInsets()); In the 3.7 (HEAD), changed calculation into: Rectangle area = getBounds().getShrinked(getInsets()); Reproduced the problem and verified the fix using the following snippet: public class Bug122219 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); LightweightSystem lws = new LightweightSystem(shell); Figure panel = new Figure(); panel.setLayoutManager(new FlowLayout()); lws.setContents(panel); PaletteData paletteData = new PaletteData(new RGB[] { new RGB(255, 0, 0), new RGB(0, 255, 0) }); ImageData imageData = new ImageData(48, 48, 1, paletteData); Image image = new Image(display, imageData); ImageFigure imageFigure = new ImageFigure(image) { protected boolean useLocalCoordinates() { return true; }; }; imageFigure.setBorder(new LineBorder(ColorConstants.black, 5)); panel.add(imageFigure); shell.setSize(400, 300); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); } } |