Class: Drawable

Drawable()

new Drawable()

Drawable Drawableとは描画できる物。 Drawable自体はあんまり機能付いてないが、これをprototypeにして描画できる画像や文字を作れます。 drawOnContext function(context) 指定されたcontextに描画します
Parameters:
Type Description
Rect
Implements:

Members

(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
Implements:

needRedraw

Properties:
Type Description
boolean

partialDraw

Properties:
Type Description
boolean

rect

Properties:
Type Description
Rect

Methods

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.
Returns:
Type
boolean

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.

frame() → {Rect}

Return the frame, which is the actually area this drawable draws on (including things like shadow). Subclass should override if needed.
Returns:
Type
Rect

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
Implements:
Returns:
- An object or serializable to be saved for the specific key, return undefined = not to be saved.
Type
object | Serializable