Class R.rendercontexts.VirtualCanvasContext
Extends
R.rendercontexts.CanvasContext.
A canvas render context whose world boundary is larger than the actual
viewport. This allows the world to be rendered as if viewed through a
window into a larger world. You can set the world position with simple
scroll methods, or cause the world to transition to a specific point over
a given duration.
Defined in: virtualcanvascontext.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.rendercontexts.VirtualCanvasContext(name, windowWidth, windowHeight, worldWidth, worldHeight)
|
- Fields borrowed from class R.rendercontexts.RenderContext2D:
- FONT_ALIGN_CENTER, FONT_ALIGN_END, FONT_ALIGN_LEFT, FONT_ALIGN_RIGHT, FONT_ALIGN_START, FONT_BASELINE_ALPHABETIC, FONT_BASELINE_BOTTOM, FONT_BASELINE_HANGING, FONT_BASELINE_IDEOGRAPHIC, FONT_BASELINE_MIDDLE, FONT_BASELINE_TOP, FONT_STYLE_ITALIC, FONT_STYLE_NORMAL, FONT_STYLE_OBLIQUE, FONT_WEIGHT_BOLD, FONT_WEIGHT_LIGHT, FONT_WEIGHT_NORMAL
- Fields borrowed from class R.struct.Container:
- EMPTY
Method Attributes | Method Name and Description |
---|---|
Get the class name of this object
|
|
Get the horizontal scroll amount in pixels.
|
|
Get the vertical scroll amount in pixels.
|
|
scrollTo(duration, ptOrX, y)
Scroll to the given point, or location, over the given duration.
|
|
Set the horizontal world position in pixels.
|
|
setScroll(pt)
Set the current world position to a specific point.
|
|
setupWorld(worldTime, dt)
If a transition was initiated with #scrollTo,
this will update the viewport accordingly.
|
|
Set the vertical world position in pixels.
|
- Methods borrowed from class R.rendercontexts.CanvasContext:
- arcTo, bezierCurveTo, captureBin, drawArc, drawFilledArc, drawFilledRectangle, drawImage, drawLine, drawPoint, drawRectangle, drawSprite, drawText, endPath, fillPath, get2DContext, getDataURL, getImage, getTextMetrics, lineTo, moveTo, popTransform, pushTransform, putImage, quadraticCurveTo, release, renderBin, reset, resetBin, setBackgroundColor, setDivisions, setFillStyle, setLineStyle, setLineWidth, setPosition, setRotation, setScale, setTransform, setWorldScale, startPath, strokePath, strokeText
- Methods borrowed from class R.rendercontexts.RenderContext2D:
- add, cleanUp, drawCircle, drawElement, drawFilledCircle, drawFilledPolygon, drawFilledRegularPolygon, drawPolygon, drawPolyline, drawRegularPolygon, getBackgroundColor, getBoundingBox, getFillStyle, getFont, getFontAlign, getFontBaseline, getFontSize, getFontStyle, getFontWeight, getHeight, getLineStyle, getLineWidth, getNormalizedFont, getPosition, getRenderPosition, getRenderRotation, getRenderScale, getRotation, getScaleX, getScaleY, getTransform, getWidth, lineSeg, postRender, remove, render, setFont, setFontAlign, setFontBaseline, setFontSize, setFontStyle, setFontWeight, setHeight, setRenderTransform, setWidth, sort, sortFn, swapBins
- Methods borrowed from class R.rendercontexts.AbstractRenderContext:
- captureMouse, captureTouch, destroy, getContextData, getExpandedViewport, getMouseInfo, getSurface, getTouchInfo, getViewport, getWorldBoundary, getWorldPosition, getWorldRotation, getWorldScale, isStatic, removeAtIndex, renderObject, resetTransformStack, setStatic, setSurface, setViewport, setWorldBoundary, setWorldPosition, setWorldRotation, uncaptureMouse, uncaptureTouch, update
- Methods borrowed from class R.struct.Container:
- addAll, append, clear, clone, concat, contains, filter, forEach, fromArray, get, getAll, getObjects, getProperties, insert, iterator, reduce, replace, replaceAt, size, subset, toXML
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, isDestroyed, setName, setObjectDataModel, toString
Class Detail
R.rendercontexts.VirtualCanvasContext(name, windowWidth, windowHeight, worldWidth, worldHeight)
- Parameters:
- name
- {String} The name of the object
- windowWidth
- {Number} The width of the viewable window, in pixels
- windowHeight
- {Number} The height of the viewable window, in pixels
- worldWidth
- {Number} The width of the world, in pixels
- worldHeight
- {Number} The height of the world, in pixels
Method Detail
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} The string "R.rendercontexts.VirtualCanvasContext"
{Number}
getHorizontalScroll()
Get the horizontal scroll amount in pixels.
- Returns:
- {Number} The horizontal scroll
{Number}
getVerticalScroll()
Get the vertical scroll amount in pixels.
- Returns:
- {Number} The vertical scroll
scrollTo(duration, ptOrX, y)
Scroll to the given point, or location, over the given duration.
- Parameters:
- duration
- {Number} The number of milliseconds for the transition to occur
- ptOrX
- {Number|R.math.Point2D} The X coordinate, or point, to scroll to
- y Optional
- {Number} The Y coordinate, if ptOrX is a number
setHorizontalScroll(x)
Set the horizontal world position in pixels.
- Parameters:
- x
- {Number} The horizontal scroll in pixels
setScroll(pt)
Set the current world position to a specific point.
- Parameters:
- pt
- {R.math.Point2D} The point to set the scroll to.
setupWorld(worldTime, dt)
If a transition was initiated with #scrollTo,
this will update the viewport accordingly.
- Parameters:
- worldTime
- {Number} The current world time
- dt
- {Number} The delta between the world time and the last time the world was updated in milliseconds.
setVerticalScroll(y)
Set the vertical world position in pixels.
- Parameters:
- y
- {Number} The vertical scroll in pixels