OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @private | 8 * @private |
9 * The period of time in milliseconds to wait between updating the viewport | 9 * The period of time in milliseconds to wait between updating the viewport |
10 * position by the scroll velocity. | 10 * position by the scroll velocity. |
11 */ | 11 */ |
12 ViewportScroller.DRAG_TIMER_INTERVAL_MS_ = 100; | 12 ViewportScroller.DRAG_TIMER_INTERVAL_MS_ = 100; |
13 | 13 |
14 /** | 14 /** |
15 * @private | 15 * @private |
16 * The maximum drag scroll distance per DRAG_TIMER_INTERVAL in pixels. | 16 * The maximum drag scroll distance per DRAG_TIMER_INTERVAL in pixels. |
17 */ | 17 */ |
18 ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_ = 100; | 18 ViewportScroller.MAX_DRAG_SCROLL_DISTANCE_ = 100; |
19 | 19 |
20 /** | 20 /** |
21 * Creates a new ViewportScroller. | 21 * Creates a new ViewportScroller. |
22 * A ViewportScroller scrolls the page in response to drag selection with the | 22 * A ViewportScroller scrolls the page in response to drag selection with the |
23 * mouse. | 23 * mouse. |
24 * @param {Object} viewport The viewport info of the page. | 24 * @param {Object} viewport The viewport info of the page. |
25 * @param {Object} plugin The PDF plugin element. | 25 * @param {Object} plugin The PDF plugin element. |
26 * @param {Object} window The window containing the viewer. | 26 * @param {Object} window The window containing the viewer. |
| 27 * @constructor |
27 */ | 28 */ |
28 function ViewportScroller(viewport, plugin, window) { | 29 function ViewportScroller(viewport, plugin, window) { |
29 this.viewport_ = viewport; | 30 this.viewport_ = viewport; |
30 this.plugin_ = plugin; | 31 this.plugin_ = plugin; |
31 this.window_ = window; | 32 this.window_ = window; |
32 this.mousemoveCallback_ = null; | 33 this.mousemoveCallback_ = null; |
33 this.timerId_ = null; | 34 this.timerId_ = null; |
34 this.scrollVelocity_ = null; | 35 this.scrollVelocity_ = null; |
35 this.lastFrameTime_ = 0; | 36 this.lastFrameTime_ = 0; |
36 } | 37 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 false); | 127 false); |
127 } else { | 128 } else { |
128 this.stopDragScrollTimer_(); | 129 this.stopDragScrollTimer_(); |
129 if (this.mousemoveCallback_) { | 130 if (this.mousemoveCallback_) { |
130 this.plugin_.removeEventListener('mousemove', this.mousemoveCallback_, | 131 this.plugin_.removeEventListener('mousemove', this.mousemoveCallback_, |
131 false); | 132 false); |
132 } | 133 } |
133 } | 134 } |
134 } | 135 } |
135 }; | 136 }; |
OLD | NEW |