ibm_ilog.diagram.widget.DivViewport
DivViewport depends on a div declared at Diagram.html with attachPoint=scrollbarsNode. This div encloses the diagram Surface.
The diagram Surface is extended to enclose the whole diagram tightly. The div is constrained to the desired client size using its width and height properties. The view rectangle is then associated with the div scroll positions, scrollTop and scrollLeft. Setting the view rectangle then updates scrollTop and scrollLeft.
The zoom level is derived from the view rectangle, but is mapped entirely different than its position. Instead, the zoom controls a scale transformation of the entire Diagram. If the view rectangle is small, the Diagram is zoomed in to fit the requested portion into the viewport window. With this also the Surface is scaled, as it is required that the entire Graph fits the surface exactly so that the scrollTop/scrollLeft properties work.
note: the zooming service required from the Diagram object should be at a UI level and should not affect, for example, the bouding box of the the Graph objects. One option is to define an intermediate node between the Surface root and the Graph node, which controls this transformation.
Method Summary
- bringIntoView(node, margin) translate the view just enough so that a given element is fully visible
- centerAt(p, options) Centers the viewport at the requested point, without changing the zoom.
- clientToContent() returns a matrix that transforms a client coordinate into a content coordinate
- constructor()
- contentToClient() returns a matrix that transforms a content coordinate into a client coordinate
- destroy() Gracefully destroys the receiver
- eventClientLocation(e)
- eventContentLocation(e)
- getAirFactor() Returns the content air percentage with respect to the client size
- getAnimLength()
- getAnimSteps()
- getAnimated()
- getBackgroundShape()
- getClientSize() Returns the current viewport client size
- getContent()
- getContentRect() The current content size in pixels, which defines the available navigation area.
- getDiagram()
- getEventSource()
- getEventSourceBackground()
- getHudLayer()
- getHudSize()
- getMaxZoom() Returns the current maximum zoom constraint.
- getMinZoom() Returns the current minimum zoom constraint.
- getOverlayLayer()
- getRefreshContentsInterval()
- getRefreshContentsSuspended()
- getResizeMode()
- getScrollbarWidth()
- getSurface()
- getUnderlayLayer()
- getViewRect() The currently displayed area in diagram coordinates.
- getViewportInverseTransform()
- getViewportTransform()
- getZoom() Returns the current zoom level based on the current view rectangle and content size.
- gfxConnector(src, evt, object, handler)
- gfxDisconnector(handle, src)
- initialize(diagram) Initializes a Viewport for collaborating with the diagram.
- isHudEnabled()
- isHudZoomFeedbackEnabled()
- isRtl() returns true if running on RTL mode. note: Peller said in the forum that RTL is supported only if set at the body. This is a dijit limitation.
- pointClientToContent(p) transforms a client coordinate into a content coordinate
- pointContentToClient(p) transforms a content coordinate into a client coordinate
- prepareViewRect(r, viewRect) Pre-apply corrections to r that would otherwise be applied at the moment r is set as the View Rectangle
- refresh() Forces a refresh contents procedure, where the content rect is updated and consequently associated scrollbars and other features.
- registerHudComponent(component)
- reset()
- setAirFactor(factor) Sets the content air percentage with respect to the client size
- setAnimLength(milliseconds)
- setAnimSteps(steps)
- setAnimated(animated)
- setClientSize(sz) Sets the client Size
- setHudEnabled(b)
- setHudZoomFeedbackEnabled(b)
- setMaxZoom(z) Sets a maximum zoom and updates the view rectangle based on new constraints.
- setMinZoom(z) Sets a minimum zoom and updates the view rectangle based on new constraints.
- setRefreshContentsInverval(msInterval)
- setRefreshContentsSuspended(suspended)
- setResizeMode(m)
- setSize(sz) Sets the Viewport Size
- setViewRect(r, options) Sets the currently displayed area.
- setZoom(zoom, options) This method is a helper that actually controls setSourceRect expanding or shrinking the view rectangle size to achieve the zoom effect.
- stopAnimation()
- templateString() This method is must return the template that the Diagram widget must use in order to use the receiver as viewport. diagram: ibm_ilog.diagram.widget.Diagram The diagram
- toString()
- updateScrollbarVisibilityFlags()
- visualizeArea(r, options) Makes the r rectangle visible, givin it an extra air between the area and the borders of the viewport if possible. The view may be zoomed out if required, but it is never zoomed in.
- zoomAt(p, z, options) Scales the current zooms by a given factor z, using point p as pivot.
Event Summary
- onClientSizeChanged() The viewport has been resized (implies the related onSourceChanged event)
- onContentRectChanged() Event triggered when the content rect has changed.
- onLayoutHud()
- onViewRectChanged() The view rectangle has been updated. scrollbars may have reappeared/disappeared
Attached Objects
Methods
Parameter | Type | Description |
---|---|---|
node | ibm_ilog.diagram.Node | |
margin | Number | Optional. |
Parameter | Type | Description |
---|---|---|
p | Point | |
options |
Parameter | Type | Description |
---|---|---|
e |
Parameter | Type | Description |
---|---|---|
e |
This value is updated by content BB change notifications (see _onContentBoundingBoxChanged)
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | The diagram |
Parameter | Type | Description |
---|---|---|
p | Point |
Parameter | Type | Description |
---|---|---|
p | Point |
Some corrections may be applied to r before assigning it as the current View Rectangle:
if width xor height are set, set the other based on current viewport aspect ratio
for each axis:
- if origin is not defined and length is, make origin so that center is preserved
if origin is defined but width is not, keep current length
if both width and height are set but the aspect ratio is not correct, correct short side to match correct aspect ratio and maintain visibility of desired area.
if r goes beyond height or width, constrain location to make r within
if r lies before the origin, set location to origin
apply zoom constraints
Parameter | Type | Description |
---|---|---|
r | dojox.gfx.Rectangle | |
viewRect | dojox.gfx.Rectangle |
Parameter | Type | Description |
---|---|---|
component |
Parameter | Type | Description |
---|---|---|
factor | Number |
Parameter | Type | Description |
---|---|---|
milliseconds | Number |
Parameter | Type | Description |
---|---|---|
steps | Number |
Parameter | Type | Description |
---|---|---|
animated | Boolean |
Parameter | Type | Description |
---|---|---|
sz | Size |
Parameter | Type | Description |
---|---|---|
b | Boolean |
Parameter | Type | Description |
---|---|---|
b | Boolean |
Parameter | Type | Description |
---|---|---|
z | Number |
Parameter | Type | Description |
---|---|---|
z | Number |
Parameter | Type | Description |
---|---|---|
msInterval | Number |
Parameter | Type | Description |
---|---|---|
suspended | Boolean |
Parameter | Type | Description |
---|---|---|
m | Number |
Parameter | Type | Description |
---|---|---|
sz | Size |
Some corrections are applied to r. See prepareViewRect.
Parameter | Type | Description |
---|---|---|
r | dojox.gfx.Rectangle | |
options | Obj | Optional. .animate animation of the viewport
.instant
cancel animated viewport
.forceApply
causes the view rect to be applied even if it has not changed
.center
causes the view rect to be centered |
Parameter | Type | Description |
---|---|---|
zoom | Number | |
options | .animate | animation of the viewport .instant cancel animated viewport .forceApply causes the view rect to be applied even if it has not changed |
Parameter | Type | Description |
---|---|---|
r | dojox.gfx.Rectangle | The area to make visible. airFactor: Percent of the area that is reserved as air. Overrides the default air factor defined bu the member _focusAirFactor. |
options | {expandCurrent,airFactor} |
Parameter | Type | Description |
---|---|---|
p | Point | |
z | Number | |
options |