Shape shape = ElementUtils.getElementShapeOrBounds(e);
Rectangle2D bounds = shape.getBounds2D();
//System.out.println("selection bounds: "+bounds);
- final double margin = 1;
- bounds.setFrame(bounds.getMinX() - margin, bounds.getMinY() - margin, bounds.getWidth() + 2*margin, bounds.getHeight() + 2*margin);
+ final double marginX = 1 / selectionTransform.getScaleX();
+ final double marginY = 1 / selectionTransform.getScaleY();
+ bounds.setFrame(bounds.getMinX() - marginX, bounds.getMinY() - marginY, bounds.getWidth() + 2*marginX, bounds.getHeight() + 2*marginY);
List<SelectionSpecification> ss = e.getElementClass().getItemsByClass(SelectionSpecification.class);
if (!ss.isEmpty()) {
public void render(Graphics2D g) {
if (!enabled)
return;
-
+
AffineTransform tr = g.getTransform();
double scaleX = Math.abs(tr.getScaleX());
double scaleY = Math.abs(tr.getScaleY());
// Vertical ruler
for(double x = offsetX%stepX-stepX; x < bounds.getMaxX(); x+=stepX) {
if(x > 20) {
- double val = (x-offsetX)/scaleX;
+ double val = (x-offsetX)/scaleX / getTransform().getScaleX();
double modifiedValue = modifyHorizontalValue(val);
String str = formatValue(modifiedValue);
FontMetrics fm = g.getFontMetrics();
previousText = -100;
for(double y = offsetY%stepY-stepY; y < bounds.getMaxY(); y+=stepY) {
if(y > 20) {
- double val = (y-offsetY)/scaleY;
+ double val = (y-offsetY)/scaleY / getTransform().getScaleY();
double modifiedValue = modifyVerticalValue(val);
String str = formatValue(modifiedValue);
FontMetrics fm = g.getFontMetrics();