Class DOMElement
- extends DisplayObject
This class is still experimental, and more advanced use is likely to be buggy. Please report bugs.
A DOMElement allows you to associate a HTMLElement with the display list. It will be transformed
within the DOM as though it is child of the Container it is added to. However, it is not rendered
to canvas, and as such will retain whatever z-index it has relative to the canvas (ie. it will be
drawn in front of or behind the canvas).
The position of a DOMElement is relative to their parent node in the DOM. It is recommended that
the DOM Object be added to a div that also contains the canvas so that they share the same position
on the page.
DOMElement is useful for positioning HTML elements over top of canvas content, and for elements
that you want to display outside the bounds of the canvas. For example, a tooltip with rich HTML
content.
DOMElement instances are not full EaselJS display objects, and do not participate in EaselJS mouse
events or support methods like hitTest.
Constructor
DOMElement
(
htmlElement
)
- Parameters:
-
htmlElement
<HTMLElement>
A reference or id for the DOM element to manage.
Properties
The DOM object to manage.
Properties inherited from DisplayObject:
_cacheDataURL,
_cacheDataURLID,
_cacheOffsetX,
_cacheOffsetY,
_matrix,
alpha,
cacheCanvas,
cacheID,
compositeOperation,
filters,
id,
mouseEnabled,
name,
parent,
regX,
regY,
rotation,
scaleX,
scaleY,
shadow,
skewX,
skewY,
snapToPixel,
visible,
x,
y
Methods
void
cache
(
)
Not applicable to DOMElement.
DOMElement
clone
(
)
This presently clones the DOMElement instance, but not the associated HTMLElement.
- Returns:
DOMElement
- a clone of the DOMElement instance.
void
draw
(
ctx
,
ignoreCache
)
Draws the display object into the specified context ignoring it's visible, alpha, shadow, and transform.
Returns true if the draw was handled (useful for overriding functionality).
NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
- Parameters:
-
ctx
<CanvasRenderingContext2D>
The canvas 2D context object to draw into.
-
ignoreCache
<Boolean>
Indicates whether the draw operation should ignore any current cache.
For example, used for drawing the cache (to prevent it from simply drawing an existing cache back
into itself).
- Returns:
void
void
globalToLocal
(
)
Not applicable to DOMElement.
protected
void
initialize
(
)
Initialization method.
Boolean
isVisible
(
)
Returns true or false indicating whether the display object would be visible if drawn to a canvas.
This does not account for whether it would be visible within the boundaries of the stage.
NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
- Returns:
Boolean
- Boolean indicating whether the display object would be visible if drawn to a canvas
void
localToGlobal
(
)
Not applicable to DOMElement.
void
localToLocal
(
)
Not applicable to DOMElement.
String
toString
(
)
Returns a string representation of this object.
- Returns:
String
- a string representation of the instance.
void
uncache
(
)
Not applicable to DOMElement.
void
updateCache
(
)
Not applicable to DOMElement.
_applyFilters,
_testHit,
_tick,
applyShadow,
cache,
clone,
cloneProps,
draw,
getCacheDataURL.,
getConcatenatedMatrix,
getStage,
globalToLocal,
hitTest,
initialize,
isVisible,
localToGlobal,
localToLocal,
setTransform,
toString,
uncache,
updateCache