mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-10-31 03:50:16 +00:00 
			
		
		
		
	more cleanup and refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									54f3532edb
								
							
						
					
					
						commit
						1029a087a0
					
				| @ -69,7 +69,7 @@ | ||||
| <script src="lib/scroller.js"></script> | ||||
| <script src="lib/keyboard.js"></script> | ||||
| 
 | ||||
| <script src="lib/log.js"></script> | ||||
| <!--script src="lib/log.js"></script--> | ||||
| 
 | ||||
| <script src="magazine.js"></script> | ||||
| <script src="layout.js"></script> | ||||
|  | ||||
| @ -34,19 +34,25 @@ var MULTITOUCH_RELEASE_THRESHOLD = 100 | ||||
| 
 | ||||
| /*********************************************************************/ | ||||
| 
 | ||||
| // Scroll handler
 | ||||
| //
 | ||||
| // This will take two elements a root (container) and a scrolled (first
 | ||||
| // child of the container) and implement drag-scrolling of the scrolled
 | ||||
| // within the root.
 | ||||
| //
 | ||||
| // This calls the following callbacks if they are defined.
 | ||||
| // 	- preCallback (unset)
 | ||||
| // 	- scrollCallback (unset)
 | ||||
| // 	- postCallback (set to postScrollCallback)
 | ||||
| //
 | ||||
| // See scroller.options for configuration.
 | ||||
| //
 | ||||
| //
 | ||||
| // XXX add a resonable cancel scheme...
 | ||||
| // 		... something similar to touch threshold but bigger...
 | ||||
| // XXX handle multiple touches...
 | ||||
| // 		- timeout on lift to count fingers...
 | ||||
| // XXX setup basic styles for the contained element...
 | ||||
| // XXX revise...
 | ||||
| // XXX test on other devices...
 | ||||
| // XXX BUG: on landing a second finger while scrolling the things goes 
 | ||||
| // 		haywhire...
 | ||||
| // 		...check if this is gone...
 | ||||
| // XXX add something like a scrollTo that would understand elements as 
 | ||||
| // 		well as explicit positions.
 | ||||
| // XXX split this into a seporate lib...
 | ||||
| function makeScrollHandler(root, config){ | ||||
| 	root = $(root) | ||||
| 
 | ||||
| @ -112,7 +118,6 @@ function makeScrollHandler(root, config){ | ||||
| 		// XXX these two are redundant...
 | ||||
| 		scrolling = true | ||||
| 		scroller.state = 'scrolling' | ||||
| 		options.enabelStartEvent && root.trigger('userScrollStart') | ||||
| 		// XXX do we need to pass something to this?
 | ||||
| 		options.preCallback && options.preCallback() | ||||
| 
 | ||||
| @ -178,7 +183,6 @@ function makeScrollHandler(root, config){ | ||||
| 			prev_y = y | ||||
| 			prev_t = t | ||||
| 
 | ||||
| 			options.enableUserScrollEvent && root.trigger('userScroll') | ||||
| 			// XXX do we need to pass something to this?
 | ||||
| 			options.scrollCallback && options.scrollCallback() | ||||
| 		} | ||||
| @ -229,7 +233,6 @@ function makeScrollHandler(root, config){ | ||||
| 		// XXX stop only if no fingers are touching or let the callback decide...
 | ||||
| 		//togglePageDragging('off')
 | ||||
| 		// XXX update this with the new data model!!! (see below)
 | ||||
| 		options.enableEndEvent && root.trigger('userScrollEnd', data) | ||||
| 		if(options.postCallback  | ||||
| 				// XXX revise this....
 | ||||
| 				&& options.postCallback(data) === false  | ||||
| @ -285,13 +288,6 @@ function makeScrollHandler(root, config){ | ||||
| 			eventBounds: 5, | ||||
| 			*/ | ||||
| 
 | ||||
| 			// these control weather in-scroll events will get triggered.
 | ||||
| 			// NOTE: these may impact performance, especially the scroll 
 | ||||
| 			// 		event, thus they need to enabled explicitly.
 | ||||
| 			enabelStartEvent: false, | ||||
| 			enableUserScrollEvent: false, | ||||
| 			enableEndEvent: false, | ||||
| 
 | ||||
| 			// callback to be called when the user first touches the screen...
 | ||||
| 			preCallback: null, | ||||
| 			// callback to be called when a scroll step is done...
 | ||||
| @ -384,8 +380,11 @@ function makeScrollHandler(root, config){ | ||||
| 	return scroller | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| // default callback...
 | ||||
| // This will provide support for the folowing events on the scroll root
 | ||||
| //
 | ||||
| // This will provide support for the following events on the scroll root
 | ||||
| // element:
 | ||||
| // 		- scrollCancelled
 | ||||
| //
 | ||||
| @ -405,9 +404,9 @@ function makeScrollHandler(root, config){ | ||||
| // NOTE: data.touches passed to the event is the number of touches 
 | ||||
| // 		released within the multitouchTimeout.
 | ||||
| // 		this differs from what postScrollCallback actually gets in the 
 | ||||
| // 		same field when it recieves the object.
 | ||||
| // 		same field when it receives the scroll data object.
 | ||||
| // XXX add generic snap
 | ||||
| // XXX add generic innertial scroll 
 | ||||
| // XXX add generic inertial scroll 
 | ||||
| // 		...see jli.js/animateElementTo for a rough implementation
 | ||||
| // XXX test multiple touches...
 | ||||
| function postScrollCallback(data){ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user