Class Scrollable
-
- All Implemented Interfaces:
public abstract class Scrollable extends Inputtable
Extensions to Component which allow it to listen to scroll events and scroll itself.
- Since:
1.6.0
-
-
Field Summary
-
Method Summary
Modifier and Type Method Description Vec2getVisibleSize()UnitsetVisibleSize(Vec2 visibleSize)final BooleangetHasVisibleSize()final UnitsetHasVisibleSize(Boolean hasVisibleSize)final BooleanisScrolling()final BooleanisScrollingX()final BooleanisScrollingY()BooleangetShouldScroll()UnitsetShouldScroll(Boolean shouldScroll)final Vec2screenAt()Booleansetup(PolyUI polyUI)give this a PolyUI reference. Unitrecalculate()Fully recalculate this component's size, and any of its children's positions. final BooleanpushScroll(Long delta, Renderer renderer)final UnitpopScroll(Renderer renderer)Booleanaccept(Event event)called when this component receives an event. final UnittryMakeScrolling()UnitfixVisibleSize()Unitrescale0(Float scaleX, Float scaleY, Boolean withChildren)raw rescale method that does not check rawResize and uses the given scale factors directly. final UnitresetScroll()reset the initial scroll position to the current position. -
Methods inherited from class org.polyfrost.polyui.component.Inputtable
acceptsInput, addEventhandler, clearHandlers, getInputState, hasListenersFor, hasListenersFor, isEnabled, isFocusable, isFocused, on, setAcceptsInput, setEnabled, setInputState -
Methods inherited from class org.polyfrost.polyui.component.Component
addChild, addChild, addOperation, addOperation, at, calculateSize, clipChildren, contains, contains, createdWithSetPosition, createdWithSetSize, debugString, extraToString, get, get, get, getAlignment, getAt, getChildren, getHeight, getInitialized, getLayoutFlags, getName, getOperations, getPadding, getParent, getParentOrNull, getPolyUI, getRenders, getSize, getWidth, getX, getY, intersects, isInside, isLayoutIgnored, isOperating, isPositioned, isRawResize, isSizeValid, position, remove, removeChild, removeChild, removeOperation, rescale, set, set, setAlignment, setAt, setHeight, setLayoutFlags, setLayoutIgnored, setName, setPadding, setParent, setRawResize, setRenders, setSize, setWidth, setX, setY, set_parent, size, toString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getVisibleSize
Vec2 getVisibleSize()
-
setVisibleSize
Unit setVisibleSize(Vec2 visibleSize)
-
getHasVisibleSize
final Boolean getHasVisibleSize()
-
setHasVisibleSize
final Unit setHasVisibleSize(Boolean hasVisibleSize)
-
isScrolling
final Boolean isScrolling()
-
isScrollingX
final Boolean isScrollingX()
-
isScrollingY
final Boolean isScrollingY()
-
getShouldScroll
Boolean getShouldScroll()
-
setShouldScroll
Unit setShouldScroll(Boolean shouldScroll)
-
setup
Boolean setup(PolyUI polyUI)
give this a PolyUI reference.
You can also use this method to do some calculations (such as text widths) that are not dependent on other sizes, or operations that require access to PolyUI things, like PolyUI.settings or PolyUI.translator
this method is called once, and only once.
-
recalculate
Unit recalculate()
Fully recalculate this component's size, and any of its children's positions.
- Since:
1.0.7
-
pushScroll
final Boolean pushScroll(Long delta, Renderer renderer)
-
accept
Boolean accept(Event event)
called when this component receives an event.
- Returns:
true if the event should be consumed (cancelled so no more handlers are called), false otherwise.
-
tryMakeScrolling
@Locking(when = "this.shouldScroll && this.hasVisibleSize && this.visibleSize > this.size") final Unit tryMakeScrolling()
-
fixVisibleSize
Unit fixVisibleSize()
-
rescale0
Unit rescale0(Float scaleX, Float scaleY, Boolean withChildren)
raw rescale method that does not check rawResize and uses the given scale factors directly.
- Parameters:
withChildren- iftrue, this method will also rescale its children.
-
resetScroll
final Unit resetScroll()
reset the initial scroll position to the current position.
This method should be used if you externally modify the position of this component with scrolling enabled.
- Since:
1.0.5
-
-
-
-