Namespace Papercube.canvasController

Extends: SC.Object
Defined in: clients/papercube/controllers/canvas.js
Version: 1.0
Author: Peter Bergstrom
Copyright: 2008-2009 Peter Bergström.

Overview

This controls the canvas, the canvas is a viewport that allows views to be resolution independent. This is done by keeping track of various zooming parameters and communicating this to the zoomView (preview pane) and the core view that is being used.

Property Summary

Method Summary

Property Details

_scrollCoolDown [R/W]

The scroll zoom cool off.

-   Integer _scrollCoolDown

Discussion

Record scroll time to compare with the _scrollCoolDownAmount.


_scrollCoolDownAmount [R/W]

The amount to wait between scroll zoom events.

-   Integer _scrollCoolDownAmount

Default Value: 200 milliseconds


fanDiv [R/W]

Fan menu div container.

-   DOM Element fanDiv


fans [R/W]

Fan menu properties.

-   Object fans


fanSVG [R/W]

Fan menu SVG.

-   DOM Element fanSVG


fanSVGRoot [R/W]

Fan menu SVG root.

-   DOM Element fanSVGRoot


leftViewShowing [R/W]

Set to YES when the left view is visible.

-   Boolean leftViewShowing

Default Value: NO


shouldShowCanvas [R/W]

boolean signifying that the app should be showing the canvas.

-   Boolean shouldShowCanvas

Default Value: NO


Method Detail

_createSVGElement()

Create a new SVG element.

-   (Array) _createSVGElement (type, attributes, events, The)

Parameters

type {string} The node type.

attributes {Object} The attributes hash.

events {Object} The events hash.

(DOM Element)The parentNode to attach to.

Returns

(Array) {DOM Element} The SVG element that was created.


_getSVGParams()

Get the fan slice details based on the event object passed in.

-   (Array) _getSVGParams (evt)

Parameters

(DOM Event)evt The mouse event.

Returns

(Array) {object} Returns the SVG params.


_highlightFan()

Set a fan's highlight or hide the fan.

-   (void) _highlightFan (evt, The)

Parameters

(DOM Event)evt The mouse event.

The {string} desired hex fill color of the fan.


circleMouseUp()

Mouse up event on the center circle of the fan.

-   (void) circleMouseUp (evt)

Parameters

(DOM Event)evt The mouseUp event.

Discussion

Then, just hide the fan.


createFan()

Based on the name and the fan type, look for the registered fan and create it.

-   (void) createFan (name, fanType)

Parameters

name {string} The view's name.

fanType {string} The type of fan.

Discussion

Fans are lazily created only when they are requested.


fanForNodeGraph()

For NodeGraphs, register using this generic function.

-   (void) fanForNodeGraph (view)

Parameters

view {NodeGraph.NodeGraphView}


getWindowProperties()

Get window properties and set the portal dimensions then reposition the canvas.

-   (void) getWindowProperties ()


hideFan()

Hide the currently visible fan.

-   (void) hideFan ()


init()

Initalization function.

-   (void) init ()

Discussion

Create the SVG elements for the fan.


panToCoordinates()

Zoom to a set of coordinates.

-   (Boolean) panToCoordinates (xDiff, yDiff, updateZoomPreview)

Parameters

xDiff {Integer} The x position of the mouse pointer.

yDiff {Integer} The y position of the mouse pointer.

updateZoomPreview {Boolean} If YES, update the zoom preview pane.

Returns

(Boolean) Returns NO if there is an error.


registerFans()

Registed the fans for a view.

-   (void) registerFans (name, fans)

Parameters

name {string} The view's name.

fans {string} The fan's options.


repositionCanvasDidChange()

Reposition the canvas inside the portal if needed, This is triggered if the percentages or the zoom value changes.

-   (void) repositionCanvasDidChange ()

Observes

percentageX

percentageY

zoomValue


setZoomToPointerLocation()

Zoom in or out to center around where the pointer location.

-   (Boolean) setZoomToPointerLocation (xPos, yPos, zoomIn)

Parameters

xPos {Integer} The x position of the mouse pointer.

yPos {Integer} The y position of the mouse pointer.

zoomIn {boolean} If YES, zoom in, otherwise, zoom out.

Returns

(Boolean) Returns NO if there is an error.


showFan()

Show a fan menu.

-   (Boolean) showFan (x, y, name, fanType)

Parameters

x {Integer} The x position.

y {Integer} The y position.

name {string} The view's name.

fanType {string} The type of fan.

Returns

(Boolean) Returns the NO if the fan name is not registered.


svgMouseDown()

SVG mouse down.

-   (void) svgMouseDown (evt)

Parameters

(DOM Event)evt The mouseDown event.

Discussion

If the event contains a wedge or fan DOM element, remove its highlight, otherwise hide the fan.


svgMouseOut()

SVG mouse over.

-   (void) svgMouseOut (evt)

Parameters

(DOM Event)evt The mouseOut event.

Discussion

If the event contains a wedge or fan DOM element, remove its highlight, otherwise hide the fan.


svgMouseOver()

SVG mouse over.

-   (void) svgMouseOver (evt)

Parameters

(DOM Event)evt The mouseOver event.

Discussion

If the event contains a wedge or fan DOM element, highlight it, otherwise hide the fan.


svgMouseUp()

SVG mouse up.

-   (void) svgMouseUp (evt)

Parameters

(DOM Event)evt The mouseUp event.

Discussion

Call back to the parent view.


zoomToLocation()

Zoom in or out to center around a desired x and y percentage.

-   (Boolean) zoomToLocation (pctX, pctY, zoomValue)

Parameters

pctX {Integer} The x position percentage.

pctY {Integer} The y position percentage.

zoomValue {Integer} The desired zoomValue.

Returns

(Boolean) Returns NO if there is an error.


Documentation generated by JsDoc Toolkit 2.0.2 on Sat Nov 21 2009 21:24:37 GMT-0800 (PST)