Skip to content

Commit

Permalink
Draw target feedback box with better graphics calculation
Browse files Browse the repository at this point in the history
- This was clipped on the right side on Mac
  • Loading branch information
Phillipus committed Feb 19, 2024
1 parent e4a4e71 commit b408ee3
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.geometry.Translatable;
import org.eclipse.swt.SWT;
Expand Down Expand Up @@ -112,19 +113,8 @@ protected void drawTargetFeedback(Graphics graphics) {
}

Rectangle bounds = getBounds().getCopy();
bounds.shrink(new Insets(1, 1, 2, 2));

// Scaling
double scale = FigureUtils.getFigureScale(this);
if(scale == 1.5) {
bounds.width--;
bounds.height--;
}
else if(scale < 1) {
bounds.width -= 2;
bounds.height -= 2;
}

bounds.shrink(1, 1);
graphics.setForegroundColor(ColorConstants.blue);
graphics.setLineWidth(2);
graphics.drawRectangle(bounds);
Expand Down

0 comments on commit b408ee3

Please sign in to comment.