shift for horizontal scroll

fixed issue with size calculation when zoomed
This commit is contained in:
Branislav Stojkovic
2018-12-15 18:23:56 +01:00
parent ed6792800b
commit 2ee81093a0
8 changed files with 260 additions and 232 deletions
@@ -99,10 +99,12 @@ public interface ISelectionProcessor {
/**
* Returns the minimum rectangle containing all selected components, or null if none exists.
* Rectangle is scaled by the current zoom level.
*
* @param applyZoom
*
* @return
*/
Rectangle2D getSelectionBounds();
Rectangle2D getSelectionBounds(boolean applyZoom);
/**
* Moves selection for the specified offset.
@@ -859,7 +859,7 @@ public class Presenter implements IPlugInPort {
}
@Override
public Rectangle2D getSelectionBounds() {
public Rectangle2D getSelectionBounds(boolean applyZoom) {
if (selectedComponents == null || selectedComponents.isEmpty())
return null;
@@ -871,7 +871,7 @@ public class Presenter implements IPlugInPort {
else
LOG.info("Area is null");
}
if (drawingManager.getZoomLevel() != 1) {
if (drawingManager.getZoomLevel() != 1 && applyZoom) {
totalArea
.transform(AffineTransform.getScaleInstance(drawingManager.getZoomLevel(), drawingManager.getZoomLevel()));
}
@@ -1881,7 +1881,7 @@ public class Presenter implements IPlugInPort {
if (selectedComponents.isEmpty()) {
return null;
}
Rectangle2D rect = getSelectionBounds();
Rectangle2D rect = getSelectionBounds(false);
double width = rect.getWidth();
double height = rect.getHeight();