Skip to content
Snippets Groups Projects
Commit a32c45f4 authored by apvrille's avatar apvrille
Browse files

Update on zoom management

parent a394398d
No related branches found
No related tags found
No related merge requests found
......@@ -97,12 +97,7 @@ public abstract class TGCScalableWithInternalComponent extends TGCWithInternalCo
maxX *= factor;
maxY *= factor;
if (father == null) {
minX = tdp.getMinX();
maxX = tdp.getMaxX();
minY = tdp.getMinY();
maxY = tdp.getMaxY();
}
//TraceManager.addDev("x=" + x + " y=" + y + " width=" + width + " height=" + height);
......@@ -111,6 +106,11 @@ public abstract class TGCScalableWithInternalComponent extends TGCWithInternalCo
if (father != null) {
// Must rescale my zone...
resizeWithFather();
} else {
minX = (int)(tdp.getMinX()/tdp.getZoom());
maxX = (int)(tdp.getMaxX()/tdp.getZoom());
minY = (int)(tdp.getMinY()/tdp.getZoom());
maxY = (int)(tdp.getMaxY()/tdp.getZoom());
}
setMoveCd(x, y, true);
......@@ -122,7 +122,6 @@ public abstract class TGCScalableWithInternalComponent extends TGCWithInternalCo
((ScalableTGComponent)tgcomponent[i]).rescale(scaleFactor);
}
}
hasBeenResized();
}
......@@ -150,10 +149,10 @@ public abstract class TGCScalableWithInternalComponent extends TGCWithInternalCo
dMaxHeight = dMaxHeight - maxHeight;
if (father == null) {
minX = tdp.getMinX();
maxX = tdp.getMaxX();
minY = tdp.getMinY();
maxY = tdp.getMaxY();
minX = (int)(tdp.getMinX()/tdp.getZoom());
maxX = (int)(tdp.getMaxX()/tdp.getZoom());
minY = (int)(tdp.getMinY()/tdp.getZoom());
maxY = (int)(tdp.getMaxY()/tdp.getZoom());
}
rescaled = true;
......
......@@ -100,6 +100,12 @@ public abstract class TGCScalableWithoutInternalComponent extends TGCWithoutInte
if (father != null) {
// Must rescale my zone...
resizeWithFather();
} else {
minX = (int)(tdp.getMinX()/tdp.getZoom());
maxX = (int)(tdp.getMaxX()/tdp.getZoom());
minY = (int)(tdp.getMinY()/tdp.getZoom());
maxY = (int)(tdp.getMaxY()/tdp.getZoom());
}
setMoveCd(x, y, true);
......@@ -128,6 +134,13 @@ public abstract class TGCScalableWithoutInternalComponent extends TGCWithoutInte
dMaxWidth = dMaxWidth - maxWidth;
dMaxHeight = dMaxHeight - maxHeight;
if (father == null) {
minX = (int)(tdp.getMinX()/tdp.getZoom());
maxX = (int)(tdp.getMaxX()/tdp.getZoom());
minY = (int)(tdp.getMinY()/tdp.getZoom());
maxY = (int)(tdp.getMaxY()/tdp.getZoom());
}
rescaled = true;
}
}
......@@ -89,7 +89,7 @@ public class TestTDiagramPanel extends AbstractUITest {
/**
* Issue #81
*/
/*@Test
@Test
public void testMoveAtomicComponentAfterZoom() {
diagramPanel.setZoom(3.0);
......@@ -100,10 +100,10 @@ public class TestTDiagramPanel extends AbstractUITest {
diagramPanel.rightComponent();
checkResults(expectedPos, atomicComponent);
}*/
}
/*
@Test
public void testMoveCompositeComponentAfterZoom() {
diagramPanel.setZoom(3.0);
......@@ -115,7 +115,7 @@ public class TestTDiagramPanel extends AbstractUITest {
diagramPanel.rightComponent();
checkResults(expectedPos, compositeComponent);
} */
}
private void checkResults(final Point expectedPos, final TGComponent component) {
assertTrue("X position is " + component.getX() + " instead of " + expectedPos.x + ".", component.getX() == expectedPos.x);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment