Merge pull request #241 from msalsbery/Button-Event-Signatures

Button event signatures fixed for consistency (#224)
This commit is contained in:
iangilman 2013-10-08 10:08:56 -07:00
commit 3dbad58ad6
2 changed files with 11 additions and 10 deletions

View File

@ -3,7 +3,6 @@ OPENSEADRAGON CHANGELOG
1.0.0: (in progress) 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: Renamed EventHandler to EventSource (#225)
* BREAKING CHANGE: MouseTracker event handler method signatures changed to 'handlerMethod( tracker, eventData)' (#23) * 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): * BREAKING CHANGE: Event names changed for consistency: changed to lower case, compound names hyphenated, and "on" prefixes removed (#226):
@ -16,6 +15,8 @@ OPENSEADRAGON CHANGELOG
* Button "onExit" changed to "exit" * Button "onExit" changed to "exit"
* Button "onFocus" changed to "focus" * Button "onFocus" changed to "focus"
* Button "onBlur" changed to "blur" * Button "onBlur" changed to "blur"
* BREAKING CHANGE: Button event handler method signatures changed to 'handlerMethod( eventSource, eventData)' where eventData == { button } (#224)
* BREAKING CHANGE: TileSource 'ready' event handler signature changed to 'handlerMethod( eventSource, eventData)' where eventData == { tileSource } (#239)
* MouseTracker now passes the original event objects to its handler methods (#23) * MouseTracker now passes the original event objects to its handler methods (#23)
* MouseTracker now supports an optional 'moveHandler' method for tracking mousemove events (#215) * 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: Element-relative mouse coordinates now correct if the element and/or page is scrolled (using new OpenSeadragon.getElementOffset() method) (#131)

View File

@ -178,7 +178,7 @@ $.Button = function( options ) {
enterHandler: function( tracker, eventData ) { enterHandler: function( tracker, eventData ) {
if ( eventData.insideElementPressed ) { if ( eventData.insideElementPressed ) {
inTo( _this, $.ButtonState.DOWN ); inTo( _this, $.ButtonState.DOWN );
_this.raiseEvent( "enter", _this ); _this.raiseEvent( "enter", { button: _this } );
} else if ( !eventData.buttonDownAny ) { } else if ( !eventData.buttonDownAny ) {
inTo( _this, $.ButtonState.HOVER ); inTo( _this, $.ButtonState.HOVER );
} }
@ -186,30 +186,30 @@ $.Button = function( options ) {
focusHandler: function ( tracker, eventData ) { focusHandler: function ( tracker, eventData ) {
this.enterHandler( tracker, eventData ); this.enterHandler( tracker, eventData );
_this.raiseEvent( "focus", _this ); _this.raiseEvent( "focus", { button: _this } );
}, },
exitHandler: function( tracker, eventData ) { exitHandler: function( tracker, eventData ) {
outTo( _this, $.ButtonState.GROUP ); outTo( _this, $.ButtonState.GROUP );
if ( eventData.insideElementPressed ) { if ( eventData.insideElementPressed ) {
_this.raiseEvent( "exit", _this ); _this.raiseEvent( "exit", { button: _this } );
} }
}, },
blurHandler: function ( tracker, eventData ) { blurHandler: function ( tracker, eventData ) {
this.exitHandler( tracker, eventData ); this.exitHandler( tracker, eventData );
_this.raiseEvent( "blur", _this ); _this.raiseEvent( "blur", { button: _this } );
}, },
pressHandler: function ( tracker, eventData ) { pressHandler: function ( tracker, eventData ) {
inTo( _this, $.ButtonState.DOWN ); inTo( _this, $.ButtonState.DOWN );
_this.raiseEvent( "press", _this ); _this.raiseEvent( "press", { button: _this } );
}, },
releaseHandler: function( tracker, eventData ) { releaseHandler: function( tracker, eventData ) {
if ( eventData.insideElementPressed && eventData.insideElementReleased ) { if ( eventData.insideElementPressed && eventData.insideElementReleased ) {
outTo( _this, $.ButtonState.HOVER ); outTo( _this, $.ButtonState.HOVER );
_this.raiseEvent( "release", _this ); _this.raiseEvent( "release", { button: _this } );
} else if ( eventData.insideElementPressed ) { } else if ( eventData.insideElementPressed ) {
outTo( _this, $.ButtonState.GROUP ); outTo( _this, $.ButtonState.GROUP );
} else { } else {
@ -219,15 +219,15 @@ $.Button = function( options ) {
clickHandler: function( tracker, eventData ) { clickHandler: function( tracker, eventData ) {
if ( eventData.quick ) { if ( eventData.quick ) {
_this.raiseEvent("click", _this); _this.raiseEvent("click", { button: _this });
} }
}, },
keyHandler: function( tracker, eventData ){ keyHandler: function( tracker, eventData ){
//console.log( "%s : handling key %s!", _this.tooltip, eventData.keyCode); //console.log( "%s : handling key %s!", _this.tooltip, eventData.keyCode);
if( 13 === eventData.keyCode ){ if( 13 === eventData.keyCode ){
_this.raiseEvent( "click", _this ); _this.raiseEvent( "click", { button: _this } );
_this.raiseEvent( "release", _this ); _this.raiseEvent( "release", { button: _this } );
return false; return false;
} }
return true; return true;