Novelty scripting reference > Types > ScrollCanvas

ScrollCanvas

ScrollCanvas is a sub-class of Object and shares all of its members and methods.
ScrollCanvas is a reference type. This means it has no constructor and can only be passed around by handle (ScrollCanvas@).

Object types that can be cast as ScrollCanvas: <ScrollCanvas>


Members

bool relative (Property)
Is the scrolling position relative to the content of the scroll canvas? If so, scrolling coordinates should be between 0 and 1.


Methods

void Scroll(float x, float y)
void Scroll(const Vector2 &in scrollPosition)
Set the scrolling coordinates of the canvas.
If relative is true the coordinates must be normalized (between 0 and 1).
If false, they are treated as pixel coordinates.

void ScrollX(float x)
Set the horizontal scrolling coordinate of the canvas.
If relative is true the coordinate must be normalized (between 0 and 1).
If false, it is treated as a pixel coordinate.

void ScrollY(float y)
Set the vertical scrolling coordinate of the canvas.
If relative is true the coordinate must be normalized (between 0 and 1).
If false, it is treated as a pixel coordinate.

Vector2 GetScrollPosition() const
Returns the current scrolling coordinates of the canvas.

Vector2 GetScrollRange() const
Returns the maximum scrolling coordinates (pixels) of the canvas based on its contents.



Sample

// Casting an Object handle to ScrollCanvas handle
ScrollCanvas@ s = Scene.GetObject("A scroll canvas object") as ScrollCanvas;

Back to top