new GlyphLayer()
- Implements:
Extends
Members
(readonly) canvas
Properties:
Name | Type | Description |
---|---|---|
canvas |
Canvas |
- Inherited From:
(readonly) ctx
Properties:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D |
- Inherited From:
(constant) initializer :string
The name of constructor the class, will be used to restore the object.
The constructor has to be accessable via
window[initializer]
Type:
- string
- Overrides:
- Implements:
needRedraw
Properties:
Type | Description |
---|---|
boolean |
- Inherited From:
partialDraw
Properties:
Type | Description |
---|---|
boolean |
- Inherited From:
rect
Properties:
Type | Description |
---|---|
Rect |
- Inherited From:
Methods
addAnimationConductor(animationConductor, segment)
Parameters:
Name | Type | Description |
---|---|---|
animationConductor |
AnimationConductor | |
segment |
number |
- Inherited From:
addImage(drawableImage)
Add image to layer
Parameters:
Name | Type | Description |
---|---|---|
drawableImage |
DrawableImage |
- Inherited From:
canDrawPartial() → {boolean}
Can it draw only a certain part?
If yes, drawContext will be called with rect, and drawable should draw only in that rect.
Drawing less = better performance.
- Inherited From:
Returns:
- Type
- boolean
children() → {Array.<Drawable>}
Drawable to be draw in the layer
- Inherited From:
Returns:
- Type
- Array.<Drawable>
clearAnimationConductors()
Remove all animation conductors.
- Inherited From:
clearImage()
Clear all images
- Inherited From:
draw(drawable)
Parameters:
Name | Type | Description |
---|---|---|
drawable |
Drawable | The drawable to redraw, it has to be one of the children. |
- Overrides:
drawOnContext(context, rect)
Draw on this context.
If canDrawPartial is true, this can be called with rect.
When it is called with rect, drawable should only draw in the specificed area.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D | |
rect |
Rect | In the context's coordinate. |
- Overrides:
flush() → {boolean}
- Inherited From:
Returns:
trueならredrawしています、falseならしていない
- Type
- boolean
frame() → {Rect}
Return the frame, which is the actually area this drawable draws on (including things like shadow).
Subclass should override if needed.
- Inherited From:
Returns:
- Type
- Rect
getCorrespondingLayer() → {Layer}
Get the fore / back corresponding layer
- Inherited From:
Returns:
- Type
- Layer
getImageRect(condition)
Parameters:
Name | Type | Description |
---|---|---|
condition |
number | string | function | conditionがnumberの場合は番号から画像を探す、0は位置一番したです stringの場合はfilenameから画像を探す、imageタグのstorage属性のような書き方で大丈夫です functionの場合はfunction (thisDrawableImage){return true/false;}こういう形で、最初にtrueを返した画像を返す |
- Inherited From:
loadImage(filename, options, allowFail) → {Promise}
Load and replace all images on this layer.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | filename of image |
options |
Object | |
allowFail |
boolean | Allow fail or keep retrying? |
- Inherited From:
Returns:
- Type
- Promise
mousedown() → {boolean}
Return true if this layer handled the event,
otherwise the event will passed to the next layer.
- Inherited From:
Returns:
- Type
- boolean
mousemove() → {boolean}
Return true if this layer handled the event,
otherwise the event will passed to the next layer.
- Inherited From:
Returns:
- Type
- boolean
mouseup() → {boolean}
Return true if this layer handled the event,
otherwise the event will passed to the next layer.
- Inherited From:
Returns:
- Type
- boolean
objectToBeSerialized(key) → {object|Serializable}
Return an object to be serialized for a specific key.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The key of property to be serialized |
- Overrides:
- Implements:
Returns:
- An object or serializable to be saved for the specific key, return undefined = not to be saved.
- Type
- object | Serializable
redrawRect(rect)
Parameters:
Name | Type | Description |
---|---|---|
rect |
Rect | Redraw a rect within the layer |
- Overrides:
setRect(rect)
Parameters:
Name | Type | Description |
---|---|---|
rect |
Rect |
- Inherited From:
showOnLayer(layer)
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer | Which layer to show on |