Index: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js |
— | — | @@ -20,7 +20,8 @@ |
21 | 21 | clickDelay: 500, |
22 | 22 | clickTimeout: null, |
23 | 23 | clickPosition: null, |
24 | | - hotSpotRadius: 1 |
| 24 | + hotSpotRadius: 1, |
| 25 | + lastMovePosition: null |
25 | 26 | }; |
26 | 27 | this.keyboard = { |
27 | 28 | selecting: false, |
— | — | @@ -96,14 +97,14 @@ |
97 | 98 | |
98 | 99 | this.dimensions = { |
99 | 100 | width: this.$.width(), |
100 | | - height: this.$.height(), |
| 101 | + height: this.$window.height(), |
101 | 102 | scrollTop: this.$window.scrollTop() |
102 | 103 | }; |
103 | 104 | |
104 | 105 | // Re-render when resizing horizontally |
105 | 106 | this.$window.resize( function() { |
106 | 107 | surfaceView.hideCursor(); |
107 | | - surfaceView.dimensions.height = surfaceView.$.height(); |
| 108 | + surfaceView.dimensions.height = surfaceView.$window.height(); |
108 | 109 | var width = surfaceView.$.width(); |
109 | 110 | if ( surfaceView.dimensions.width !== width ) { |
110 | 111 | surfaceView.dimensions.width = width; |
— | — | @@ -200,32 +201,35 @@ |
201 | 202 | this.cursor.initialLeft = null; |
202 | 203 | return false; |
203 | 204 | }; |
204 | | -var lastEventPosition = new es.Position(); |
| 205 | + |
205 | 206 | es.SurfaceView.prototype.onMouseMove = function( e ) { |
206 | 207 | if ( e.button === 0 /* left mouse button */ && this.mouse.selecting ) { |
207 | | - |
208 | | - |
209 | | - if ( e.pageY - $(window).scrollTop() < 0 ) { |
210 | | - lastEventPosition = es.Position.newFromEventPagePosition( e ); |
211 | | - stopScrolling(); |
212 | | - startScrolling(true); |
213 | | - } else if ( e.pageY - $(window).scrollTop() <= window.innerHeight ) { |
214 | | - stopScrolling(); |
| 208 | + if ( e.pageY - this.dimensions.scrollTop < 0 ) { |
| 209 | + //this.mouse.lastMovePosition = |
| 210 | + this.scroll( 'up' ); |
| 211 | + } else if( e.pageY - this.dimensions.scrollTop > this.dimensions.height ) { |
| 212 | + this.scroll( 'down' ); |
215 | 213 | } else { |
216 | | - lastEventPosition = es.Position.newFromEventPagePosition( e ); |
217 | | - stopScrolling(); |
218 | | - startScrolling(); |
| 214 | + this.scroll( 'stop' ); |
| 215 | + this.hideCursor(); |
| 216 | + this.selection.to = this.documentView.getOffsetFromEvent( e ); |
| 217 | + if ( !this.drawSelection() ) { |
| 218 | + this.showCursor(); |
| 219 | + } |
219 | 220 | } |
220 | | - |
221 | | - this.hideCursor(); |
222 | | - this.selection.to = this.documentView.getOffsetFromEvent( e ); |
223 | | - if ( !this.drawSelection() ) { |
224 | | - this.showCursor(); |
225 | | - } |
226 | | - |
227 | 221 | } |
228 | 222 | }; |
229 | 223 | |
| 224 | +es.SurfaceView.prototype.scroll = function( type ) { |
| 225 | +/* |
| 226 | + switch ( type ) { |
| 227 | + case 'down': |
| 228 | + this.mouse.lastMovePosition = |
| 229 | + break; |
| 230 | + }; |
| 231 | +*/ |
| 232 | +}; |
| 233 | + |
230 | 234 | es.SurfaceView.prototype.onMouseUp = function( e ) { |
231 | 235 | if ( e.button === 0 /* left mouse button */ && this.selection.to ) { |
232 | 236 | if ( this.drawSelection() ) { |
— | — | @@ -377,6 +381,7 @@ |
378 | 382 | |
379 | 383 | |
380 | 384 | |
| 385 | + |
381 | 386 | var scrollStepDown = function() { |
382 | 387 | lastEventPosition.top += 20; |
383 | 388 | lastEventPosition.bottom += 20; |