use of org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle in project Terasology by MovingBlocks.
the class MultiBlockParagraphRenderable method getContentsMinWidth.
@Override
public int getContentsMinWidth(ParagraphRenderStyle defaultStyle) {
FallbackParagraphRenderStyle fallbackStyle = new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
int paragraphIndents = fallbackStyle.getParagraphMarginLeft().getValue(0) + fallbackStyle.getParagraphPaddingLeft().getValue(0) + fallbackStyle.getParagraphPaddingRight().getValue(0) + fallbackStyle.getParagraphMarginRight().getValue(0);
return paragraphIndents + DocumentRenderer.getParagraphsMinimumWidth(0, fallbackStyle, paragraphs);
}
use of org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle in project Terasology by MovingBlocks.
the class MultiBlockParagraphRenderable method getPreferredContentsHeight.
@Override
public int getPreferredContentsHeight(ParagraphRenderStyle defaultStyle, int yStart, ContainerRenderSpace containerRenderSpace, int sideIndents) {
FallbackParagraphRenderStyle fallbackStyle = new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
int containerWidth = containerRenderSpace.getContainerWidth();
int topIndent = fallbackStyle.getParagraphMarginTop().getValue(containerWidth) + fallbackStyle.getParagraphPaddingTop().getValue(containerWidth);
int paragraphIndents = topIndent + fallbackStyle.getParagraphPaddingBottom().getValue(containerWidth) + fallbackStyle.getParagraphMarginBottom().getValue(containerWidth);
return paragraphIndents + DocumentRenderer.getParagraphsPreferredHeight(fallbackStyle, paragraphs, containerRenderSpace, yStart + topIndent);
}
use of org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle in project Terasology by MovingBlocks.
the class MultiBlockParagraphRenderable method renderContents.
@Override
public void renderContents(Canvas canvas, Vector2i startPos, ContainerRenderSpace containerRenderSpace, int leftIndent, int rightIndent, ParagraphRenderStyle defaultStyle, HorizontalAlign horizontalAlign, HyperlinkRegister hyperlinkRegister) {
FallbackParagraphRenderStyle fallbackStyle = new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
int containerWidth = containerRenderSpace.getContainerWidth();
int leftIndents = fallbackStyle.getParagraphMarginLeft().getValue(containerWidth) + fallbackStyle.getParagraphPaddingLeft().getValue(containerWidth);
int rightIndents = fallbackStyle.getParagraphPaddingRight().getValue(containerWidth) + fallbackStyle.getParagraphMarginRight().getValue(containerWidth);
int topIndents = fallbackStyle.getParagraphMarginTop().getValue(containerWidth) + fallbackStyle.getParagraphPaddingTop().getValue(containerWidth);
DocumentRenderer.renderParagraphs(canvas, hyperlinkRegister, fallbackStyle, startPos.x, startPos.y + topIndents, leftIndent + leftIndents, rightIndent + rightIndents, paragraphs, containerRenderSpace);
}
Aggregations