ControlBox.js

1 ) function: toString
2 ) function: checkResetDisable
3 ) function: adjustAnchor
4 ) function: reverseControls
5 ) function: reverseUpDownSlid
6 ) function: reverseLeftRight
7 ) function: reverseUpDown
8 ) function: addCenterBox
9 ) function: addBorder
10 ) function: adjustCenterMarkH
11 ) function: adjustCenterMarkV
12 ) function: crossMoveH
13 ) function: crossMoveV
14 ) function: cross_resetH
15 ) function: cross_resetV
16 ) function: markCenterH
17 ) function: markCenterV
18 ) function: transLeft
19 ) function: transRight
20 ) function: transUp
21 ) function: transDown
22 ) function: lock_aspect
23 ) function: scaleUpH
24 ) function: scaleUpV
25 ) function: scaleDownH
26 ) function: scaleDownV
27 ) function: createButton


Object: ControlBox

Object Description:
Example:
Inherits from: Nothing

Notes: Each Window object has an associated ControlBox
Originally, the control box was, indeed a box. Now it is a
collection of buttons, and it might be more appropriate to have
rewrite it as a ControlGroup, and inherit from a generic Group
class.
This class is highly coupled to the Window class


Constructor: ControlBox
  • Parameter
    : parent - parent GUI object that will contain this ControlBox
target - GUI object (Content) which this ControlBox will control
ctrl_opts - one of:
ControlBox.ALL_CTRLS || 0xFF
ControlBox.SCROLLV_CTRLS || 0x1
ControlBox.SCROLLH_CTRLS || 0x2
ControlBox.SCALE_CTRLSH || 0x4
ControlBox.SCALE_CTRLSV || 0x8
ControlBox.YCOORD_DISP || 0x20
ControlBox.XCOORD_DISP || 0x10
ControlBox.CROSSV || 0x40
ControlBox.CROSSH || 0x80
ControlBox.RESET || 0X100


There is documentation/code mismatch


Method: checkResetDisable
Description: used by Window to check if RESET has been enabled
returns 1 for false, and 0 for true.
Added: Nishan Sothilingam


Method: adjustAnchor
Description:
- adjust the anchor of any controls that exist
- this is primarily used when resizing a window.


Method: reverseControls
Description: swap up/down and left/right


Method: reverseUpDownSlid
Description: sets the slider settings when a BAC is rotated
into a positive OR negative orientation.
Added: Nishan Sothilingam


Method: reverseLeftRight
Description: swap left/right


Method: reverseUpDown
Description: swap up/down


Method: addCenterBox
Description: Add a box to the top/center of the parent which
displays the center coordinate of the parents
content.

  • Parameter
    : vert - which vertex this box will monitor (X, Y)


Method: addBorder
Description: Add a border to the controls which acts as a buffer
zone to detect a crosshair reset. The border covers all edges
of the content window and is somewhat transparent so it blends in
well with the rest of the contents. This is neccessary because
we need to activate the reset only when an svg object that is not
a window is triggered. So we have to ignore everything in the main
content pane, and use a BAR type border. So when a mouseover event
occurs, we know a BAR as been hit, and not an item in the window.

  • Parameter
    : type - which type this box will be
Added: Nishan Sothilingam


Method: adjustCenterMarkH
Description:
CenterMarkH refers to the bar down the middle marking the
horizontal center of the display. This function adjusts
it in response to the window being resized.


Method: adjustCenterMarkV
Description:
CenterMarkV refers to the bar down the middle marking the
verticle center of the display. This function adjusts it
in response to the window being resized.


Method: crossMoveH
Description: Keeps track of the cross hairs on the horizontal
access and adjusts it according to the mouse position
parameter: posy - this is the y position
parameter: posx - this is the x position
content-height: A numerical value representing the window height in pixels
Added:Nishan Sothilingam


Method: crossMoveV
Description: Keeps track of the cross hairs on the vertical
access and adjusts it according to the mouse position
parameter: posy - this is the y position
parameter: posx - this is the x position
content-width: A numerical value representing the window width in pixels
Added: Nishan Sothilingam


Method: cross_resetH
Description: resets the horizontal cross hair position to the center of the
content pane.
parameter: content_width: used for calculating the center for crosshair
reset
Added: Nishan Sothilingam


Method: cross_resetV
Description: resets the vertical cross hair position to the center of the
content pane.
parameter: content_height, used in calculating crosshair reset
Added: Nishan Sothilingam


Method: markCenterH
Description:
CenterMarkH refers to the bar down the middle marking the
Horizontal center of the display. This function creates it.


Method: markCenterV
Description:
CenterMarkV refers to the bar down the middle marking the
Verticle center of the display. This function creates it.


Method: transLeft
Description: translate the content left
  • Parameter
    : evt - the event triggering this request
Quirk: slider integration with dynamic scale is not correct,
though there are several solutions, none of the ones
I had could do it perfectly



Method: transRight
Description: translate the content right
  • Parameter
    : evt - the event triggering this request
Quirk: slider integration with dynamic scale is not correct,
though there are several solutions, none of the ones
I had could do it perfectly


Method: setAnchor
Description: Set this anchor.
  • Parameter
    : target - the object to anchor to.
  • Parameter
    : ax - "left" "center" "right", the horizontal anchor position
  • Parameter
    : offsetx - the offset ('+':right '-':left) from the ax position
  • Parameter
    : ay - "top" "center" "bottom", the vertical anchor position
  • Parameter
    : offsety - the offset ('+':down '-':up) from the ay position

Example:
Continuing the setAnchor (frame, "left", "15", "bottom", "-15")
would anchor the object(the button)
Added - Chris Peto


Method: setAnchor

There is invalid Documentation present

Description: Set this anchor.
  • Parameter
    : target - the object to anchor to.
  • Parameter
    : ax - "left" "center" "right", the horizontal anchor position
  • Parameter
    : offsetx - the offset ('+':right '-':left) from the ax position
  • Parameter
    : ay - "top" "center" "bottom", the vertical anchor position
  • Parameter
    : offsety - the offset ('+':down '-':up) from the ay position

Example:
Continuing the setAnchor (frame, "left", "15", "bottom", "-15")
would anchor the object(the button)
@ added - Chris Peto


Method: transUp
Description: translate the content up
  • Parameter
    : evt - the event triggering this request


Method: transDown
Description: translate the content down
  • Parameter
    : evt - the event triggering this request


Method: scaleUpHori
Description: called when content is to be scaled
  • Parameter
    : evt - the event triggering this request


Method: scaleDownHori
Description: called when content is to be scaled
  • Parameter
    : evt - the event triggering this request


Method: scaleUpVert
Description: called when content is to be scaled
  • Parameter
    : evt - the event triggering this request


Method: scaleDownVert
Description: called when content is to be scaled
  • Parameter
    : evt - the event triggering this request


Method: lock
Description: Tell the content to scale down in the vertical dir
  • Parameter
    : evt - event causing this scaling

There is documentation/code mismatch


Method: scaleUpH
Description: Tell the content to scale in the horizontal direction
  • Parameter
    : evt - event causing this scaling


Method: scaleUpV
Description: Tell the content to scale in the vertical direction
  • Parameter
    : evt - event causing this scaling


Method: scaleDownH
Description: Tell the content to scale down in the horizontal dir
  • Parameter
    : evt - event causing this scaling


Method: scaleDownV
Description: Tell the content to scale down in the vertical dir
  • Parameter
    : evt - event causing this scaling


Method: createButton
Description: creates the buttons available in the control box.
  • Parameter
    : c - the button to create
options are: ^ - up
v - down
< - left
> - right
+ - zoomin horizontal
- - zoomout horizontal
i - zoomin verticle
o - zoomout verticle


Notes: Behaviour of the buttons
mousedown event calls
^ - transUp(evt)
> - transRight(evt)
< - transLeft(evt)
v - transDown(evt)
+ - scaleUpH(evt)
- - scaleDownH(evt)
i - scaleUpV(evt)
o - scaleDownV(evt)

the mousedown events set a timer which will call them again
after x seconds if the mouse is still down & in the button.

mouseOut - clears timeout - preventing additional calls
mouseUp - clears timeout - preventing additional calls


Method: clearTimeout
Description: clear the timer being used to allow scrolling to
occur while the mouse button is held down.

  • Parameter
    : evt - the event causing the timer to clear