use of limelight.util.Box in project limelight by slagyr.
the class NinePatchTest method itIsInitializedWithAnImage.
@Test
public void itIsInitializedWithAnImage() throws Exception {
NinePatch.Info info = NinePatch.Info.inspect(image);
assertEquals(new Box(1, 1, 3, 11), info.topLeftBounds);
assertEquals(new Box(4, 1, 5, 11), info.topMiddleBounds);
assertEquals(new Box(9, 1, 7, 11), info.topRightBounds);
assertEquals(new Box(1, 12, 3, 13), info.middleLeftBounds);
assertEquals(new Box(4, 12, 5, 13), info.middleMiddleBounds);
assertEquals(new Box(9, 12, 7, 13), info.middleRightBounds);
assertEquals(new Box(1, 25, 3, 17), info.bottomLeftBounds);
assertEquals(new Box(4, 25, 5, 17), info.bottomMiddleBounds);
assertEquals(new Box(9, 25, 7, 17), info.bottomRightBounds);
}
use of limelight.util.Box in project limelight by slagyr.
the class BorderPainterTest method setUp.
public void setUp() throws Exception {
panel = new MockProp();
style = panel.getStyle();
border = new Box(5, 5, 100, 100);
panel.boxInsideMargins = border;
painter = BorderPainter.instance;
graphics = new MockGraphics();
}
use of limelight.util.Box in project limelight by slagyr.
the class BorderTest method setUp.
public void setUp() {
style = new FlatStyle();
insideMargin = new Box(0, 0, 100, 200);
}
use of limelight.util.Box in project limelight by slagyr.
the class InputPanelLayout method doExpansion.
@Override
public void doExpansion(Panel thePanel) {
PanelBase panel = (PanelBase) thePanel;
Box bounds = panel.getParent().getChildConsumableBounds();
panel.setLocation(bounds.x, bounds.y);
panel.setSize(bounds.width, bounds.height);
}
use of limelight.util.Box in project limelight by slagyr.
the class PropPanelLayout method snapToSize.
public void snapToSize(PropPanel panel) {
if (// can happen if removed from tree
panel.getParent() == null)
return;
Box maxArea = panel.getParent().getChildConsumableBounds();
Style style = panel.getStyle();
if (style.getCompiledWidth() instanceof AutoDimensionValue && style.getCompiledHeight() instanceof GreedyDimensionValue)
throw new LimelightException("A greedy height is not allowed with auto width.");
int newWidth = style.getCompiledWidth().calculateDimension(maxArea.width, style.getCompiledMinWidth(), style.getCompiledMaxWidth(), panel.greediness.width);
int newHeight = style.getCompiledHeight().calculateDimension(maxArea.height, style.getCompiledMinHeight(), style.getCompiledMaxHeight(), panel.greediness.height);
// TODO MDM - Hacky Hack!!!! More thought needs to go into the way layouts are down and how greedy fits into it all
// if(topLevel && style.getCompiledWidth() instanceof GreedyDimensionValue && panel.getWidth() > newWidth)
// newWidth = panel.getWidth();
// if(topLevel && style.getCompiledHeight() instanceof GreedyDimensionValue && panel.getHeight() > newHeight)
// newHeight = panel.getHeight();
panel.setSize(newWidth, newHeight);
panel.resetPendingSizeChange();
}
Aggregations