Merge pull request #1579 from MoritzBrueckner/canvas
CanvasScript: add getCanvas() function and improve docstrings
This commit is contained in:
commit
ce16c194a5
|
@ -77,17 +77,32 @@ class CanvasScript extends Trait {
|
|||
onReady = f;
|
||||
}
|
||||
|
||||
// Defines layout
|
||||
/**
|
||||
* Returns an element of the canvas.
|
||||
* @param name The name of the element
|
||||
* @return TElement
|
||||
*/
|
||||
public function getElement(name: String): TElement {
|
||||
for (e in canvas.elements) if (e.name == name) return e;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns canvas array of elements
|
||||
/**
|
||||
* Returns an array of the elements of the canvas.
|
||||
* @return Array<TElement>
|
||||
*/
|
||||
public function getElements(): Array<TElement> {
|
||||
return canvas.elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the canvas object of this trait.
|
||||
* @return TCanvas
|
||||
*/
|
||||
public function getCanvas(): Null<TCanvas> {
|
||||
return canvas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set visibility of canvas
|
||||
* @param visible Whether canvas should be visible or not
|
||||
|
|
Loading…
Reference in a new issue