Skip to content

Commit d5f03af

Browse files
committed
Figure image position needs to be reduced by 1 pixel
- If image is on bottom/right it will over-spill
1 parent 992f815 commit d5f03af

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/elements/CommunicationNetworkFigure.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ protected void drawFigure(Graphics graphics) {
4343
graphics.pushState();
4444

4545
Rectangle rect = getBounds().getCopy();
46-
Rectangle imageBounds = rect.getCopy();
46+
47+
// Reduce by one pixel in case of bottom/right postion
48+
Rectangle imageBounds = rect.getCopy().resize(-1, -1);
4749

4850
setFigurePositionFromTextPosition(rect);
4951

com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/elements/DistributionNetworkFigure.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,19 @@ protected void drawFigure(Graphics graphics) {
4949
graphics.pushState();
5050

5151
Rectangle rect = getBounds().getCopy();
52+
53+
// Reduce by one pixel in case of bottom/right postion
54+
Rectangle imageBounds = rect.getCopy().resize(-1, -1);
5255

5356
if(!isEnabled()) {
5457
setDisabledState(graphics);
5558
}
5659

57-
setFigurePositionFromTextPosition(rect, 5/3.0);
58-
5960
// Calculate line width depending on size
6061
int lineWidth = (int)Math.max(3, Math.sqrt(rect.width * rect.height) / 24);
6162

63+
setFigurePositionFromTextPosition(rect, 5/3.0);
64+
6265
// Shrink the arrow size area depending on line width
6366
Dimension arrowSize = getArrowSize(rect);
6467
rect.shrink(lineWidth, lineWidth);
@@ -78,7 +81,7 @@ protected void drawFigure(Graphics graphics) {
7881
drawHorizontalLine(graphics, rect, arrowSize);
7982

8083
// Image Icon
81-
drawIconImage(graphics, rect, 0, 0, 0, 0);
84+
drawIconImage(graphics, imageBounds, 0, 0, 0, 0);
8285

8386
graphics.popState();
8487
}

com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/elements/DriverFigure.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ protected void drawFigure(Graphics graphics) {
4242
graphics.pushState();
4343

4444
Rectangle rect = getBounds().getCopy();
45-
//rect.width--;
46-
//rect.height--;
4745

48-
Rectangle imageBounds = rect.getCopy();
46+
// Reduce by one pixel in case of bottom/right postion
47+
Rectangle imageBounds = rect.getCopy().resize(-1, -1);
4948

50-
// Set line width here so that the whole figure is constrained, otherwise SVG graphics will have overspill
51-
//setLineWidth(graphics, 1, rect);
5249
int lineWidth = (int)(Math.sqrt(rect.width * rect.height) / 20);
5350
graphics.setLineWidth(lineWidth);
5451

com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/elements/PlateauFigure.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ protected void drawFigure(Graphics graphics) {
4343

4444
Rectangle rect = getBounds().getCopy();
4545

46-
Rectangle imageBounds = rect.getCopy();
46+
// Reduce by one pixel in case of bottom/right postion
47+
Rectangle imageBounds = rect.getCopy().resize(-1, -1);
4748

4849
setFigurePositionFromTextPosition(rect, 5/3.5);
4950

com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/elements/WorkPackageFigure.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ protected void drawFigure(Graphics graphics) {
5656

5757
Rectangle rect = getBounds().getCopy();
5858

59-
Rectangle imageBounds = rect.getCopy();
59+
// Reduce by one pixel in case of bottom/right postion
60+
Rectangle imageBounds = rect.getCopy().resize(-1, -1);
6061

6162
setFigurePositionFromTextPosition(rect, 8/7.0);
6263

0 commit comments

Comments
 (0)