~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to lib/helioviewer/ViewportHandlers.js

  • Committer: V. Keith Hughitt
  • Date: 2009-01-29 21:30:16 UTC
  • Revision ID: hughitt1@kore-20090129213016-ecqgjwaj89lt9vn0
nightly build 01-29-2009: Added jsdoc-toolkit generated code documentation. See /docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @fileOverview Contains the class definition for an ViewportHandlers class.
 
3
 * @author <a href="mailto:keith.hughitt@gmail.com">Keith Hughitt</a>
 
4
 * @author <a href="mailto:patrick.schmiedel@gmx.net">Patrick Schmiedel</a>
 
5
 */
1
6
/*global Class, Object, document, window, Event, $ */
2
 
var ViewportHandlers = Class.create({
 
7
var ViewportHandlers = Class.create(
 
8
        /** @lends ViewportHandlers.prototype */
 
9
        {
3
10
        startingPosition:      { x: 0, y: 0 },
4
11
        mouseStartingPosition: { x: 0, y: 0 },
5
12
        mouseCurrentPosition:  { x: 0, y: 0 },
10
17
        naturalResolution : 2.63,
11
18
        rSunArcSeconds    : 975,
12
19
 
 
20
        /**
 
21
         * @constructs
 
22
         * @description Contains a collection of event-handlers for dealing with Viewport-related events
 
23
         * @see Viewport
 
24
         * @param {Object} viewport A Reference to the Helioviewer application class
 
25
         */
13
26
        initialize: function (viewport) {
14
27
                this.viewport = viewport;
15
28
 
32
45
                Event.observe(window, 'keypress', this.keyPress.bindAsEventListener(this));
33
46
        },
34
47
 
 
48
        /**
 
49
         * @description Fired when a mouse is pressed
 
50
         * @param {Event} event Prototype Event class
 
51
         */
35
52
        mouseDown: function (event) {
36
53
                //this.viewport.output('down');n
37
54
                this.viewport.isMoving = true;
47
64
                this.viewport.startMoving();
48
65
        },
49
66
 
 
67
        /**
 
68
         * @description Handles double-clicks
 
69
         * @param {Event} e Prototype Event class
 
70
         */
50
71
        doubleClick: function (e) {
51
72
                var viewport = this.viewport;
52
73
                
77
98
                }
78
99
        },
79
100
        
 
101
        /**
 
102
         * @description Handles mouse-wheel movements
 
103
         * @param {Event} event Prototype Event class
 
104
         */
80
105
        mouseWheel: function (e) {
81
106
                this.viewport.controller.zoomControl.zoomButtonClicked(-Event.wheel(e));
82
107
        },
83
108
        
84
109
        /**
85
 
         * @function
86
110
         * @description Get the mouse-coords relative to top-left of the viewport frame
87
 
         * @param {Object}
 
111
         * @param {Int} screenx X-dimensions of the user's screen
 
112
         * @param {Int} screeny Y-dimensions of the user's screen
88
113
         */
89
114
        getRelativeCoords: function (screenx, screeny) {
90
115
                var vp = this.viewport;
103
128
        },
104
129
 
105
130
        /**
106
 
         * @function keyPress
107
131
         * @description Keyboard-related event-handlers
108
132
         */
109
133
        keyPress: function (e) {
143
167
                }
144
168
        },
145
169
 
 
170
        /**
 
171
         * @description Fired when a mouse button is released
 
172
         * @param {Event} event Prototype Event object
 
173
         */
146
174
        mouseUp: function (event) {
147
175
                //this.viewport.output('up');
148
176
                this.viewport.isMoving = false;
153
181
                this.viewport.endMoving();
154
182
        },
155
183
 
 
184
        /**
 
185
         * @description Fired when a keyboard key is released
 
186
         * @param {Object} event Prototype Event object
 
187
         */
156
188
        keyRelease: function (event) {
157
189
                this.viewport.isMoving = false;
158
190
                this.viewport.endMoving();
159
191
        },
160
192
 
161
193
        /**
162
 
         * @function
163
194
         * @description Handle drag events
 
195
         * @param {Object} event Prototype Event object
164
196
         */
165
197
        mouseMove: function (event) {
166
198
                if (!this.viewport.isMoving) {
189
221
        },
190
222
        
191
223
        /**
192
 
         * @function
193
224
         * @description Toggles mouse-coords visibility
194
225
         */
195
226
        toggleMouseCoords: function () {