| Constructor and Description |
|---|
LayerUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
bind(Layer layer,
Signal<Clock> paint,
Slot<Clock> onPaint)
Automatically connects
onPaint to paint when layer is added to a scene
graph, and disconnects it when layer is removed. |
static void |
bind(Layer layer,
Signal<Clock> update,
Slot<Clock> onUpdate,
Signal<Clock> paint,
Slot<Clock> onPaint)
Automatically connects
onUpdate to update, and onPaint to paint when layer is added to a scene graph, and disconnects them when layer
is removed. |
static Layer |
getHitLayer(Layer root,
Point p)
Returns the layer hit by (screen) position
p (or null) in the scene graph rooted at
root, using Layer.hitTest(pythagoras.f.Point). |
static int |
graphDepth(Layer layer)
Returns the depth of the given layer in its local scene graph.
|
static boolean |
hitTest(Layer layer,
float x,
float y)
Returns true if a coordinate on the screen touches a
Layer. |
static boolean |
hitTest(Layer layer,
XY pos)
|
static int |
indexInParent(Layer layer)
Returns the index of the given layer within its parent, or -1 if the parent is null.
|
static Point |
layerToParent(Layer layer,
Layer parent,
float x,
float y)
Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer.
|
static Point |
layerToParent(Layer layer,
Layer parent,
XY point,
Point into)
Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer.
|
static Point |
layerToScreen(Layer layer,
float x,
float y)
Converts the supplied point from coordinates relative to the specified
layer to screen coordinates.
|
static Point |
layerToScreen(Layer layer,
XY point,
Point into)
Converts the supplied point from coordinates relative to the specified layer to screen
coordinates.
|
static Layer |
layerUnderPoint(Layer root,
float x,
float y)
Gets the layer underneath the given screen coordinates, ignoring hit testers.
|
static Point |
parentToLayer(Layer parent,
Layer layer,
XY point,
Point into)
Converts the supplied point from coordinates relative to the specified parent to coordinates
relative to the specified child layer.
|
static Point |
parentToLayer(Layer layer,
XY point,
Point into)
Converts the supplied point from coordinates relative to its parent
to coordinates relative to the specified layer.
|
static void |
print(Log log,
Layer layer)
Prints the layer heirarchy starting at
layer, using Log.debug(java.lang.String). |
static Point |
screenToLayer(Layer layer,
float x,
float y)
Converts the supplied point from screen coordinates to coordinates
relative to the specified layer.
|
static Point |
screenToLayer(Layer layer,
XY point,
Point into)
Converts the supplied point from screen coordinates to coordinates
relative to the specified layer.
|
public static Point layerToScreen(Layer layer, XY point, Point into)
into, which is returned for convenience.public static Point layerToScreen(Layer layer, float x, float y)
public static Point layerToParent(Layer layer, Layer parent, XY point, Point into)
into, which is returned for convenience.public static Point layerToParent(Layer layer, Layer parent, float x, float y)
public static Point screenToLayer(Layer layer, XY point, Point into)
into
, which is returned for convenience.public static Point screenToLayer(Layer layer, float x, float y)
public static Point parentToLayer(Layer layer, XY point, Point into)
into, which is returned for convenience.public static Point parentToLayer(Layer parent, Layer layer, XY point, Point into)
into, which is
returned for convenience.public static Layer getHitLayer(Layer root, Point p)
p (or null) in the scene graph rooted at
root, using Layer.hitTest(pythagoras.f.Point). Note that p is mutated by this call.public static boolean hitTest(Layer layer, float x, float y)
Layer. Note: if the supplied
layer has no size, this will always return false.public static Layer layerUnderPoint(Layer root, float x, float y)
public static int indexInParent(Layer layer)
public static void bind(Layer layer, Signal<Clock> paint, Slot<Clock> onPaint)
onPaint to paint when layer is added to a scene
graph, and disconnects it when layer is removed.public static void bind(Layer layer, Signal<Clock> update, Slot<Clock> onUpdate, Signal<Clock> paint, Slot<Clock> onPaint)
onUpdate to update, and onPaint to paint when layer is added to a scene graph, and disconnects them when layer
is removed.public static int graphDepth(Layer layer)
public static void print(Log log, Layer layer)
layer, using Log.debug(java.lang.String).Copyright © 2017. All Rights Reserved.