Layer
<script type="text/javascript>
// Access a SignStix layer by its name.
var priceLayer = SignStixGraphics.getLayerNamed('Price');
// Modify properties of that layer.
priceLayer.setText('£9.99!');
priceLayer.setFontSize(80);
priceLayer.setFontColour('#00FF00'); // Green
// Tell SignStix to update its graphics accordingly.
SignStixGraphics.updateDisplay();
</script>
Note that when dealing with layer coordinates, the origin (0, 0) is at the
top left of the sign.Modifier and Type | Function and Description |
---|---|
void |
addCarouselImage(String fileRef,
String newLayerName)
Add an image to the end of the carousel layer's image list.
|
void |
carouselShiftDown()
Attempt to decrement this carousel layer's selection index and invoke animations on the
carousel's images to reflect that change.
|
void |
carouselShiftUp()
Attempt to increment this carousel layer's selection index and invoke animations on the
carousel's images which reflect that change.
|
void |
clearCarousel()
Remove any images from this carousel layer and set its selection index to 0.
|
String |
getBlockColour()
Find the colour of this block layer.
|
int |
getCarouselSelectionIndex()
Find the current selection index of this carousel layer.
|
String |
getFontColour()
Find the font colour of this text layer.
|
String |
getFontFace()
Find the font face name of this text layer.
|
int |
getFontSize()
Find the font size of this text layer.
|
String |
getFontWeight()
Find the weight of this text layer.
|
int |
getHeight()
Find the Height of this layer within the sign.
|
int |
getId()
Find the ID of this layer.
|
int |
getLeft()
Find the basic left coordinate of this layer within the sign.
|
String |
getName()
Find the name of this layer, if any.
|
int |
getNumCarouselImages()
Find the number of images in this carousel layer's image list.
|
String |
getText()
Find the current text in this text layer.
|
int |
getTop()
Find the basic top coordinate of this layer within the sign.
|
int |
getWidth()
Find the Width of this layer within the sign.
|
boolean |
isSelected()
Find out if this image layer is in the selected state.
|
void |
setBlockColour(String htmlColour)
Set the colour of this block layer to be the argument.
|
void |
setCarouselSelectionIndex(int index)
Attempt to set the selection index of this carousel layer, which may cause images to
reposition
accordingly.
|
void |
setFontColour(String htmlColour)
Set the font colour of this text layer to be the argument.
|
void |
setFontFace(String fontName)
Set the font face of this text layer to be the argument.
|
void |
setFontSize(int size)
Set the font size of this text layer to be the argument.
|
void |
setFontWeight(String weight)
Set the weight of this text layer to be the argument.
|
void |
setHeight(int px)
Set the Height of this layer within the sign.
|
void |
setImageFromFile(String fileRef)
Set the image source of this image layer to be a specific file in the associated
folder structure.
|
void |
setImageFromLayerNamed(String layerName)
Set the image source of this image layer to be the same as that of the
argument image layer.
|
void |
setImageFromUrl(String imageUrl,
boolean forceNewDownload,
String jsFunctionName)
Set the image source of this layer to be the image file available at the
argument URL.
|
void |
setInteractive(boolean isInteractive)
Set the interactive state of a web view.
|
void |
setLeft(int left)
Set the basic left coordinate of this layer within the sign.
|
void |
setSelected(boolean selected)
Set the selected state of this image layer.
|
void |
setText(String text)
Set the text on this layer.
|
void |
setTextFromLayerNamed(String layerName)
Set the text on this text layer to be the same as that of the argument text
layer.
|
void |
setTop(int top)
Set the basic top coordinate of this layer within the sign.
|
void |
setVisible(boolean visibility)
Set the visibility of the layer.
|
void |
setWidth(int px)
Set the Width of this layer within the sign.
|
String getName()
int getId()
void setWidth(int px)
px
- in pixels.void setHeight(int px)
px
- Height in pixelsint getWidth()
int getHeight()
int getLeft()
void setLeft(int left)
left
- the new coordinate of the layer's left-most edge.int getTop()
void setTop(int top)
top
- the new coordinate of the layer's top-most edge.void setVisible(boolean visibility)
visibility
- true if visible, otherwise falsevoid setText(String text)
If the layer is not a text layer, this function will log an error and return.
Call SignStixGraphics.updateDisplay()
for the change to take
effect.
text
- the new text to adopt. Must not be null.String getText()
If the layer is not a text layer, this function will log an error and return null.
void setFontSize(int size)
size
- must be in the range 1 to 10000.int getFontSize()
void setFontColour(String htmlColour)
htmlColour
- font colour in HTML format e.g. '#FF0000' for red,
'#00FF00' for green.String getFontColour()
void setFontFace(String fontName)
fontName
- the name of the required font.String getFontFace()
void setFontWeight(String weight)
weight
- one of {"normal", "bold"}.String getFontWeight()
void setImageFromLayerNamed(String layerName)
If the receiving layer is not an image layer, or the argument does not identify an image layer, this function will log an error and return.
Call SignStixGraphics.updateDisplay()
for the change to take
effect.
layerName
- the name of an image layer.void setImageFromUrl(String imageUrl, boolean forceNewDownload, String jsFunctionName)
On completion, a callback function will be invoked to indicate success (or
otherwise). On success, call SignStixGraphics.updateDisplay()
for
the change to take effect.
Reasons for failure may include:
Note that if the sign is restarted (e.g. as a result of a content re-deployment, or a device or application restart), the layer will revert to its original image.
imageUrl
- URL of the image file to download (must be a PNG or JPEG
file).forceNewDownload
- when true, this will force a new download even if
the file from a previous download for this URL is still available.
When false, this will attempt to re-use a previously downloaded
file, if there is one available.jsFunctionName
- the name of a Javascript callback function that
will be called on completion. It must take parameters as follows:
void setImageFromFile(String fileRef)
If the receiving layer is not an image layer, or the parameter does not resolve to a known file, this function will log an error and return false.
Call SignStixGraphics.updateDisplay()
for the change to take effect.
fileRef
- file reference (produced by SignStixFiles) identifying an image file
within the associated folder structure.void setTextFromLayerNamed(String layerName)
Note that this will not change the bounding box of the text layer, so a long piece of text may wrap or not be visible.
If the receiving layer is not a text layer, or the argument does not identify a text layer, this function will log an error and return.
Call SignStixGraphics.updateDisplay()
for the change to take
effect.
layerName
- name of the layer that provides the text.void setBlockColour(String htmlColour)
htmlColour
- block colour in HTML format e.g. '#FF0000' for red,
'#00FF00' for green.String getBlockColour()
boolean isSelected()
void setInteractive(boolean isInteractive)
isInteractive
- true to set the layer interactive, false to non-interactive.void setSelected(boolean selected)
selected
- true to select the layer, false to de-select.void clearCarousel()
If the receiving layer is not a carousel layer, this function will log an error and return.
void addCarouselImage(String fileRef, String newLayerName)
If the receiving layer is not a carousel layer, this function will log an error and return.
fileRef
- reference to an image file looked-up via SignStixFiles.newLayerName
- the layer name to use when a layer is created for this image.int getNumCarouselImages()
If the receiving layer is not a carousel layer, this function will log an error and return 0.
int getCarouselSelectionIndex()
If the receiving layer is not a carousel layer, this function will log an error and return -1.
void setCarouselSelectionIndex(int index)
If the receiving layer is not a carousel layer, this function will log an error and return -1.
index
- the index in the image list to become selected (from 0 to the number of
images).void carouselShiftUp()
If the receiving layer is not a carousel layer, this function will log an error and return false.
void carouselShiftDown()
If the receiving layer is not a carousel layer, this function will log an error and return false.