From 5c37a1f375b26322699e3671b00edde578d098ae Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Wed, 2 Oct 2013 13:09:40 -0700 Subject: [PATCH 1/5] Ready event signature fixed for consistency Signature now handlerMethod(eventSource, eventData) --- src/tilesource.js | 16 +++------------- src/viewer.js | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/tilesource.js b/src/tilesource.js index 9352487e..641f0e65 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -117,15 +117,8 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve for ( i = 0; i < arguments.length; i++ ) { if ( $.isFunction( arguments[ i ] ) ) { callback = arguments[ i ]; - // TODO Send generic object wrapping readySource as a property (breaking change) - // TODO Maybe placeHolderSource should be passed to callback as well for consistency - // with event handler signature? - // Should be this (although technically it works as-is): - //this.addHandler( 'ready', function ( placeHolderSource, placeHolderArgs ) { - // callback( placeHolderArgs ); - //} ); - this.addHandler( 'ready', function ( placeHolderSource, readySource ) { - callback( readySource ); + this.addHandler( 'ready', function ( placeHolderSource, placeHolderEventData ) { + callback( placeHolderSource, placeHolderEventData ); } ); //only one callback per constructor break; @@ -308,10 +301,7 @@ $.TileSource.prototype = { options = $TileSource.prototype.configure.apply( _this, [ data, url ]); readySource = new $TileSource( options ); _this.ready = true; - // TODO Send generic object wrapping readySource as a property (breaking change) - // Should be this: - //_this.raiseEvent( 'ready', { tileSource: readySource } ); - _this.raiseEvent( 'ready', readySource ); + _this.raiseEvent( 'ready', { tileSource: readySource } ); }; if( url.match(/\.js$/) ){ diff --git a/src/viewer.js b/src/viewer.js index 65199316..ecd8560f 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -438,8 +438,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, setTimeout(function(){ if ( $.type( tileSource ) == 'string') { //If its still a string it means it must be a url at this point - tileSource = new $.TileSource( tileSource, function( readySource ){ - openTileSource( _this, readySource ); + tileSource = new $.TileSource( tileSource, function( eventSource, eventData ){ + openTileSource( _this, eventData.tileSource ); }); tileSource.addHandler( 'open-failed', function ( name, args ) { _this.raiseEvent( 'open-failed', args ); From 2b3a3aa687e571e46ae0c58be090f5b00e500a80 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Wed, 2 Oct 2013 13:15:08 -0700 Subject: [PATCH 2/5] changelog.txt updated for breaking change TileSource ready event handler method signature changed --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 1ea02eb6..45fe8038 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ OPENSEADRAGON CHANGELOG 1.0.0: (in progress) +* BREAKING CHANGE: TileSource 'ready' event handler signature changed for consistency to 'handlerMethod( eventSource, eventData)' (#239) * BREAKING CHANGE: Renamed EventHandler to EventSource (#225) * BREAKING CHANGE: MouseTracker event handler method signatures changed to 'handlerMethod( tracker, eventData)' (#23) * BREAKING CHANGE: Event names changed for consistency: changed to lower case, compound names hyphenated, and "on" prefixes removed (#226): From 9928a6d92572fc52c100deb0389a8cec949d1365 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Thu, 3 Oct 2013 12:11:33 -0700 Subject: [PATCH 3/5] Fix for touch event issue #240 --- src/mousetracker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index 5161c879..66e2a458 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -1020,7 +1020,7 @@ function onMouseUpCaptured( tracker, event, noRelease, isTouch ) { isTouch = isTouch || false; - if ( !THIS[ tracker.hash ].insideElement ) { + if ( !THIS[ tracker.hash ].insideElement || isTouch ) { onMouseUp( tracker, event, isTouch ); } From 47b32eaae9b3873a5659fad1d01581dec9c60e32 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Thu, 3 Oct 2013 15:51:44 -0700 Subject: [PATCH 4/5] changelog update for touch event issue #240 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 1ea02eb6..dd039343 100644 --- a/changelog.txt +++ b/changelog.txt @@ -18,6 +18,7 @@ OPENSEADRAGON CHANGELOG * MouseTracker now passes the original event objects to its handler methods (#23) * MouseTracker now supports an optional 'moveHandler' method for tracking mousemove events (#215) * Fixed: Element-relative mouse coordinates now correct if the element and/or page is scrolled (using new OpenSeadragon.getElementOffset() method) (#131) +* Fixed: Touch event issue where no canvas-click events were being raised (#240) 0.9.131: From 2264306785d59b5f1c495c15d1403c4e77fbb213 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Thu, 3 Oct 2013 16:41:09 -0700 Subject: [PATCH 5/5] changelog.txt update for event signature change --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 45fe8038..ee099c7f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,7 +3,7 @@ OPENSEADRAGON CHANGELOG 1.0.0: (in progress) -* BREAKING CHANGE: TileSource 'ready' event handler signature changed for consistency to 'handlerMethod( eventSource, eventData)' (#239) +* BREAKING CHANGE: TileSource 'ready' event handler signature changed for consistency to 'handlerMethod( eventSource, eventData)' where eventData == { tileSource } (#239) * BREAKING CHANGE: Renamed EventHandler to EventSource (#225) * BREAKING CHANGE: MouseTracker event handler method signatures changed to 'handlerMethod( tracker, eventData)' (#23) * BREAKING CHANGE: Event names changed for consistency: changed to lower case, compound names hyphenated, and "on" prefixes removed (#226):