Class Papercube.ZoomView
| Extends: | SC.View |
| Defined in: | clients/papercube/views/zoom.js |
| Version: | 1.0 |
| Author: | Peter Bergstrom |
| Copyright: | 2008-2009 Peter Bergström. |
Overview
ZoomView is the preview view and control view for the portal/canvas paradigm that allows for resolution independence.
Property Summary
-
- (String) _actionType [R/W]Action type is either drag or click. -
- (Array) _bounds [R/W]The bounds that are used for rendering the zoomView. -
- (Integer) _ptrXOffset [R/W]Used to offset your mouse pointer's x inside the preview portal view so that it doesn't jump. -
- (Integer) _ptrYOffset [R/W]Used to offset your mouse pointer's y inside the preview portal view so that it doesn't jump. -
- (Boolean) _zoomDirty [R/W]Internal boolean that specifies if the zoom has been touched or not. -
- (Object) canvasPreview [R/W]This is the DIV element for the preview canvas. -
- (Integer) heightBinding [R/W]The portal height, set by the canvasController. -
- (Boolean) isVisible [R/W]Is the view visible? -
- (Boolean) isZoomingBinding [R/W]Zooming or not, set by the canvasController. -
- (Object) outlets [R/W]The zoom view has two outlets, the canvas and portal, the portal is the visible window. -
- (Float) percentageX [R/W]The x-axis percentage. -
- (Float) percentageXBinding [R/W]The x percentage, set by the canvasController. -
- (Float) percentageY [R/W]The y-axis percentage. -
- (Float) percentageYBinding [R/W]The y percentage, set by the canvasController. -
- (Object) portalPreview [R/W]This is the DIV element for the preview portal. -
- (Integer) widthBinding [R/W]The portal width, set by the canvasController. -
- (Integer) zoomValueBinding [R/W]The zoom value, set by the canvasController.
Method Summary
-
- (void) _setPercentage()Set the percentage back to the controller. -
- (void) _setPreviewPosition(x, y)Set the preview box position as you're dragging. -
- (void) applyZoomTransition()Add the zoom class so it animates. -
- (void) isZoomingDidChange()Observes isZooming and shows the view it is needed. -
- (void) mouseDown(evt)Handle the mouseDown action. -
- (void) mouseDragged(evt)When it is dragged, handle it. -
- (void) mouseUp(evt)This will end a drag or position after a click. -
- (void) positionPreviewBox(x, y, height, height)Set the position and dimensions of the portalPreview. -
- (Boolean) redrawParamsDidChange()Redraw the zoomView as needed based on 'height', 'width', 'zoomValue'. -
- (void) setParams(pctX, pctY)Set the preview box position and percentages. -
- (void) updatePreviewBox(pctX, pctY)Update preview box postion.
Property Details
_actionType [R/W]
Action type is either drag or click.
- String _actionType
Default Value: ''
Discussion
The positioning behavior changes depending on what this parameter is.
_ptrXOffset [R/W]
Used to offset your mouse pointer's x inside the preview portal view so that it doesn't jump.
- Integer _ptrXOffset
Default Value: 0
_ptrYOffset [R/W]
Used to offset your mouse pointer's y inside the preview portal view so that it doesn't jump.
- Integer _ptrYOffset
Default Value: 0
_zoomDirty [R/W]
Internal boolean that specifies if the zoom has been touched or not.
- Boolean _zoomDirty
Default Value: NO
heightBinding [R/W]
The portal height, set by the canvasController.
- Integer heightBinding
Bound To: "Papercube.canvasController.portalHeight"
isZoomingBinding [R/W]
Zooming or not, set by the canvasController.
- Boolean isZoomingBinding
Bound To: "Papercube.canvasController.isZooming"
outlets [R/W]
The zoom view has two outlets, the canvas and portal, the portal is the visible window.
- Object outlets
percentageXBinding [R/W]
The x percentage, set by the canvasController.
- Float percentageXBinding
Bound To: "Papercube.canvasController.percentageX"
percentageYBinding [R/W]
The y percentage, set by the canvasController.
- Float percentageYBinding
Bound To: "Papercube.canvasController.percentageY"
widthBinding [R/W]
The portal width, set by the canvasController.
- Integer widthBinding
Bound To: "Papercube.canvasController.portalWidth"
zoomValueBinding [R/W]
The zoom value, set by the canvasController.
- Integer zoomValueBinding
Bound To: "Papercube.canvasController.zoomValue"
Method Detail
_setPreviewPosition()
Set the preview box position as you're dragging.
- (void) _setPreviewPosition (x, y)
Parameters
x {Integer} The x-position.
y {Integer} The y-position.
Discussion
Make sure it does not leave the bounds of the canvas.
isZoomingDidChange()
Observes isZooming and shows the view it is needed.
- (void) isZoomingDidChange ()
Observes
isZooming
mouseDown()
Handle the mouseDown action.
- (void) mouseDown (evt)
Parameters
(DOM Event)evt The mouseDown event.
mouseDragged()
When it is dragged, handle it.
- (void) mouseDragged (evt)
Parameters
(DOM Event)evt The mouseDragged event.
mouseUp()
This will end a drag or position after a click.
- (void) mouseUp (evt)
Parameters
(DOM Event)evt The mouseUp event.
positionPreviewBox()
Set the position and dimensions of the portalPreview.
- (void) positionPreviewBox (x, y, height, height)
Parameters
x {Integer} The x-position.
y {Integer} The y-position.
height {Integer} The box height
height {Integer} The box width
redrawParamsDidChange()
Redraw the zoomView as needed based on 'height', 'width', 'zoomValue'.
- (Boolean) redrawParamsDidChange ()
Returns
(Boolean) Returns NO if there is no guid of if the view is not visible.
Observes
height
width
zoomValue
setParams()
Set the preview box position and percentages.
- (void) setParams (pctX, pctY)
Parameters
pctX {Integer} The x percentage.
pctY {Integer} The y percentage.
updatePreviewBox()
Update preview box postion.
- (void) updatePreviewBox (pctX, pctY)
Parameters
pctX {Integer} The x percentage.
pctY {Integer} The y percentage.