Class: ImageLayer

ImageLayer()

new ImageLayer()

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

addImage(drawableImage)

Add image to layer
Parameters:
Name Type Description
drawableImage DrawableImage

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
Overrides:
Returns:
Type
Array.<Drawable>

clearAnimationConductors()

Remove all animation conductors.

clearImage()

Clear all images

draw(drawable)

Parameters:
Name Type Description
drawable Drawable The drawable to redraw, it has to be one of the children.
Inherited From:

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.
Inherited From:

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を返した画像を返す

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?
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
Inherited From:

setRect(rect)

Parameters:
Name Type Description
rect Rect
Inherited From: