com.badlogic.gdx.scenes.scene2d.utils.Cullable Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.utils.Cullable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScrollPane.java    From riiablo with Apache License 2.0 5 votes vote down vote up
private void updateWidgetPosition () {
	// Calculate the widget's position depending on the scroll state and available widget area.
	float y = widgetAreaBounds.y;
	//if (!scrollY)
	//	y -= (int)maxY;
	//else
		y -= (int)(maxY - visualAmountY);

	float x = widgetAreaBounds.x;
	/*if (scrollX) */x -= (int)visualAmountX;

	if (!fadeScrollBars && scrollbarsOnTop) {
		if (scrollX && hScrollOnBottom) {
			float scrollbarHeight = 0;
			if (style.hScrollKnob != null) scrollbarHeight = style.hScrollKnob.getMinHeight();
			if (style.hScroll != null) scrollbarHeight = Math.max(scrollbarHeight, style.hScroll.getMinHeight());
			y += scrollbarHeight;
		}
		if (scrollY && !vScrollOnRight) {
			float scrollbarWidth = 0;
			if (style.hScrollKnob != null) scrollbarWidth = style.hScrollKnob.getMinWidth();
			if (style.hScroll != null) scrollbarWidth = Math.max(scrollbarWidth, style.hScroll.getMinWidth());
			x += scrollbarWidth;
		}
	}

	widget.setPosition(x, y);

	if (widget instanceof Cullable) {
		widgetCullingArea.x = widgetAreaBounds.x - x;
		widgetCullingArea.y = widgetAreaBounds.y - y;
		widgetCullingArea.width = widgetAreaBounds.width;
		widgetCullingArea.height = widgetAreaBounds.height;
		((Cullable)widget).setCullingArea(widgetCullingArea);
	}
}