Draws entities as DOM nodes, specifically <DIV>
s.
public this .getId()
Get the Id of the DOM element used to represent the entity.
public this .DOM(HTMLElement elem)
Pass a DOM element to use rather than one created. Will set ._element
to this value. Removes the old element.
public this .draw([[Context ctx, ]Number x, Number y, Number w, Number h])
Method to draw the entity on the canvas element. Can pass rect values for redrawing a segment of the entity.
public * css(String property, String value)
public * css(Object map)
Apply CSS styles to the element.
Can pass an object where the key is the style property and the value is style value.
For setting one style, simply pass the style as the first argument and the value as the second.
The notation can be CSS or JS (e.g. text-align
or textAlign
).
To return a value, pass the property.
Note: For entities with "Text" component, some css properties are controlled by separate functions
.textFont()
and .textColor()
, and ignore .css()
settings. See Text component for details.
this.css({'text-align', 'center', 'text-decoration': 'line-through'});
this.css("textAlign", "center");
this.css("text-align"); //returns center