diff --git a/src/button.js b/src/button.js index 86755a72..062abf8a 100644 --- a/src/button.js +++ b/src/button.js @@ -152,13 +152,13 @@ $.Button = function( options ) { } - this.addHandler( "onPress", this.onPress ); - this.addHandler( "onRelease", this.onRelease ); - this.addHandler( "onClick", this.onClick ); - this.addHandler( "onEnter", this.onEnter ); - this.addHandler( "onExit", this.onExit ); - this.addHandler( "onFocus", this.onFocus ); - this.addHandler( "onBlur", this.onBlur ); + this.addHandler( "press", this.onPress ); + this.addHandler( "release", this.onRelease ); + this.addHandler( "click", this.onClick ); + this.addHandler( "enter", this.onEnter ); + this.addHandler( "exit", this.onExit ); + this.addHandler( "focus", this.onFocus ); + this.addHandler( "blur", this.onBlur ); this.currentState = $.ButtonState.GROUP; @@ -178,7 +178,7 @@ $.Button = function( options ) { enterHandler: function( tracker, eventData ) { if ( eventData.insideElementPressed ) { inTo( _this, $.ButtonState.DOWN ); - _this.raiseEvent( "onEnter", _this ); + _this.raiseEvent( "enter", _this ); } else if ( !eventData.buttonDownAny ) { inTo( _this, $.ButtonState.HOVER ); } @@ -186,30 +186,30 @@ $.Button = function( options ) { focusHandler: function ( tracker, eventData ) { this.enterHandler( tracker, eventData ); - _this.raiseEvent( "onFocus", _this ); + _this.raiseEvent( "focus", _this ); }, exitHandler: function( tracker, eventData ) { outTo( _this, $.ButtonState.GROUP ); if ( eventData.insideElementPressed ) { - _this.raiseEvent( "onExit", _this ); + _this.raiseEvent( "exit", _this ); } }, blurHandler: function ( tracker, eventData ) { this.exitHandler( tracker, eventData ); - _this.raiseEvent( "onBlur", _this ); + _this.raiseEvent( "blur", _this ); }, pressHandler: function ( tracker, eventData ) { inTo( _this, $.ButtonState.DOWN ); - _this.raiseEvent( "onPress", _this ); + _this.raiseEvent( "press", _this ); }, releaseHandler: function( tracker, eventData ) { if ( eventData.insideElementPressed && eventData.insideElementReleased ) { outTo( _this, $.ButtonState.HOVER ); - _this.raiseEvent( "onRelease", _this ); + _this.raiseEvent( "release", _this ); } else if ( eventData.insideElementPressed ) { outTo( _this, $.ButtonState.GROUP ); } else { @@ -219,15 +219,15 @@ $.Button = function( options ) { clickHandler: function( tracker, eventData ) { if ( eventData.quick ) { - _this.raiseEvent("onClick", _this); + _this.raiseEvent("click", _this); } }, keyHandler: function( tracker, eventData ){ //console.log( "%s : handling key %s!", _this.tooltip, eventData.keyCode); if( 13 === eventData.keyCode ){ - _this.raiseEvent( "onClick", _this ); - _this.raiseEvent( "onRelease", _this ); + _this.raiseEvent( "click", _this ); + _this.raiseEvent( "release", _this ); return false; } return true; diff --git a/src/drawer.js b/src/drawer.js index de94356c..c1b3646a 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -204,7 +204,7 @@ $.Drawer.prototype = { }) ); this.updateAgain = true; if( this.viewer ){ - this.viewer.raiseEvent( 'add-overlay', { + this.viewer.raiseEvent( 'addoverlay', { viewer: this.viewer, element: element, location: options.location, @@ -236,7 +236,7 @@ $.Drawer.prototype = { this.updateAgain = true; } if( this.viewer ){ - this.viewer.raiseEvent( 'update-overlay', { + this.viewer.raiseEvent( 'updateoverlay', { viewer: this.viewer, element: element, location: location, @@ -266,7 +266,7 @@ $.Drawer.prototype = { this.updateAgain = true; } if( this.viewer ){ - this.viewer.raiseEvent( 'remove-overlay', { + this.viewer.raiseEvent( 'removeoverlay', { viewer: this.viewer, element: element }); @@ -286,7 +286,7 @@ $.Drawer.prototype = { this.updateAgain = true; } if( this.viewer ){ - this.viewer.raiseEvent( 'clear-overlay', { + this.viewer.raiseEvent( 'clearoverlay', { viewer: this.viewer }); } @@ -481,7 +481,7 @@ function updateViewport( drawer ) { drawer.updateAgain = false; if( drawer.viewer ){ - drawer.viewer.raiseEvent( 'update-viewport', { + drawer.viewer.raiseEvent( 'updateviewport', { viewer: drawer.viewer }); } @@ -657,7 +657,7 @@ function updateLevel( drawer, haveDrawn, drawLevel, level, levelOpacity, levelVi if( drawer.viewer ){ - drawer.viewer.raiseEvent( 'update-level', { + drawer.viewer.raiseEvent( 'updatelevel', { viewer: drawer.viewer, havedrawn: haveDrawn, level: level, @@ -721,7 +721,7 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le drawTile = drawLevel; if( drawer.viewer ){ - drawer.viewer.raiseEvent( 'update-tile', { + drawer.viewer.raiseEvent( 'updatetile', { viewer: drawer.viewer, tile: tile }); @@ -1235,7 +1235,7 @@ function drawTiles( drawer, lastDrawn ){ } if( drawer.viewer ){ - drawer.viewer.raiseEvent( 'tile-drawn', { + drawer.viewer.raiseEvent( 'tiledrawn', { viewer: drawer.viewer, tile: tile }); diff --git a/src/strings.js b/src/strings.js index 9616850a..6e375808 100644 --- a/src/strings.js +++ b/src/strings.js @@ -46,7 +46,7 @@ var I18N = { Security: "It looks like a security restriction stopped us from " + "loading this Deep Zoom Image.", Status: "This space unintentionally left blank ({0} {1}).", - "Open-Failed": "Unable to open {0}: {1}" + "OpenFailed": "Unable to open {0}: {1}" }, Tooltips: { diff --git a/src/tilesource.js b/src/tilesource.js index 9352487e..54c01241 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -301,7 +301,7 @@ $.TileSource.prototype = { callback = function( data ){ var $TileSource = $.TileSource.determineType( _this, data, url ); if ( !$TileSource ) { - _this.raiseEvent( 'open-failed', { message: "Unable to load TileSource", source: url } ); + _this.raiseEvent( 'openfailed', { message: "Unable to load TileSource", source: url } ); return; } @@ -351,7 +351,7 @@ $.TileSource.prototype = { msg = formattedExc + " attempting to load TileSource"; } - _this.raiseEvent( 'open-failed', { + _this.raiseEvent( 'openfailed', { message: msg, source: url }); diff --git a/src/viewer.js b/src/viewer.js index 4887d844..8057b717 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -172,8 +172,8 @@ $.Viewer = function( options ) { //Inherit some behaviors and properties $.EventSource.call( this ); - this.addHandler( 'open-failed', function (source, args) { - var msg = $.getString( "Errors.Open-Failed", args.source, args.message); + this.addHandler( 'openfailed', function (source, args) { + var msg = $.getString( "Errors.OpenFailed", args.source, args.message); _this._showMessage( msg ); }); @@ -441,8 +441,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, tileSource = new $.TileSource( tileSource, function( readySource ){ openTileSource( _this, readySource ); }); - tileSource.addHandler( 'open-failed', function ( name, args ) { - _this.raiseEvent( 'open-failed', args ); + tileSource.addHandler( 'openfailed', function ( name, args ) { + _this.raiseEvent( 'openfailed', args ); }); } else if ( $.isPlainObject( tileSource ) || tileSource.nodeType ){ @@ -455,7 +455,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, //inline configuration $TileSource = $.TileSource.determineType( _this, tileSource ); if ( !$TileSource ) { - _this.raiseEvent( 'open-failed', { + _this.raiseEvent( 'openfailed', { message: "Unable to load TileSource", source: tileSource }); @@ -569,7 +569,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, */ setMouseNavEnabled: function( enabled ){ this.innerTracker.setTracking( enabled ); - this.raiseEvent( 'mouse-enabled', { enabled: enabled, viewer: this } ); + this.raiseEvent( 'mouseenabled', { enabled: enabled, viewer: this } ); return this; }, @@ -603,7 +603,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, } else { beginControlsAutoHide( this ); } - this.raiseEvent( 'controls-enabled', { enabled: enabled, viewer: this } ); + this.raiseEvent( 'controlsenabled', { enabled: enabled, viewer: this } ); return this; }, @@ -1439,7 +1439,7 @@ function onCanvasClick( tracker, eventData ) { ); this.viewport.applyConstraints(); } - this.raiseEvent( 'canvas-click', { + this.raiseEvent( 'canvasclick', { tracker: tracker, position: eventData.position, quick: eventData.quick, @@ -1464,7 +1464,7 @@ function onCanvasDrag( tracker, eventData ) { this.viewport.applyConstraints(); } } - this.raiseEvent( 'canvas-drag', { + this.raiseEvent( 'canvasdrag', { tracker: tracker, position: eventData.position, delta: eventData.delta, @@ -1476,7 +1476,7 @@ function onCanvasRelease( tracker, eventData ) { if ( eventData.insideElementPressed && this.viewport ) { this.viewport.applyConstraints(); } - this.raiseEvent( 'canvas-release', { + this.raiseEvent( 'canvasrelease', { tracker: tracker, position: eventData.position, insideElementPressed: eventData.insideElementPressed, @@ -1494,7 +1494,7 @@ function onCanvasScroll( tracker, eventData ) { ); this.viewport.applyConstraints(); } - this.raiseEvent( 'canvas-scroll', { + this.raiseEvent( 'canvasscroll', { tracker: tracker, position: eventData.position, scroll: eventData.scroll, @@ -1511,7 +1511,7 @@ function onContainerExit( tracker, eventData ) { beginControlsAutoHide( this ); } } - this.raiseEvent( 'container-exit', { + this.raiseEvent( 'containerexit', { tracker: tracker, position: eventData.position, insideElementPressed: eventData.insideElementPressed, @@ -1526,7 +1526,7 @@ function onContainerRelease( tracker, eventData ) { beginControlsAutoHide( this ); } } - this.raiseEvent( 'container-release', { + this.raiseEvent( 'containerrelease', { tracker: tracker, position: eventData.position, insideElementPressed: eventData.insideElementPressed, @@ -1537,7 +1537,7 @@ function onContainerRelease( tracker, eventData ) { function onContainerEnter( tracker, eventData ) { THIS[ this.hash ].mouseInside = true; abortControlsAutoHide( this ); - this.raiseEvent( 'container-enter', { + this.raiseEvent( 'containerenter', { tracker: tracker, position: eventData.position, insideElementPressed: eventData.insideElementPressed, diff --git a/src/viewport.js b/src/viewport.js index 691851c4..3ea56afa 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -121,7 +121,7 @@ $.Viewport.prototype = { this.homeBounds = new $.Rect( 0, 0, 1, this.contentAspectY ); if( this.viewer ){ - this.viewer.raiseEvent( 'reset-size', { + this.viewer.raiseEvent( 'resetsize', { contentSize: contentSize, viewer: this.viewer }); diff --git a/test/basic.js b/test/basic.js index 50e51cab..ffab85ad 100644 --- a/test/basic.js +++ b/test/basic.js @@ -51,7 +51,7 @@ start(); }); - viewer.addHandler('open-failed', function(eventSender, eventData) { + viewer.addHandler('openfailed', function(eventSender, eventData) { ok(true, "The open-failed event should be fired when the source 404s"); equal($(".openseadragon-message").length, 1, "Open failures should display a message"); diff --git a/test/events.js b/test/events.js index d99799be..687387f3 100644 --- a/test/events.js +++ b/test/events.js @@ -61,7 +61,7 @@ } ); // ---------- - asyncTest( 'MouseTracker, EventSource canvas-drag canvas-release canvas-click', function () { + asyncTest( 'MouseTracker, EventSource canvasdrag canvasrelease canvasclick', function () { var $canvas = $( viewer.element ).find( '.openseadragon-canvas' ).not( '.navigator .openseadragon-canvas' ), mouseTracker = null, userData = { item1: 'Test user data', item2: Math.random() }, @@ -78,9 +78,9 @@ var onOpen = function ( eventSender, eventData ) { viewer.removeHandler( 'open', onOpen ); - viewer.addHandler( 'canvas-drag', onEventSourceDrag ); - viewer.addHandler( 'canvas-release', onEventSourceRelease ); - viewer.addHandler( 'canvas-click', onEventSourceClick ); + viewer.addHandler( 'canvasdrag', onEventSourceDrag ); + viewer.addHandler( 'canvasrelease', onEventSourceRelease ); + viewer.addHandler( 'canvasclick', onEventSourceClick ); mouseTracker = new OpenSeadragon.MouseTracker( { element: $canvas[0], @@ -172,13 +172,13 @@ checkOriginalEventReceived( eventData ); mouseTracker.destroy(); - viewer.removeHandler( 'canvas-drag', onEventSourceDrag ); - viewer.removeHandler( 'canvas-release', onEventSourceRelease ); - viewer.removeHandler( 'canvas-click', onEventSourceClick ); + viewer.removeHandler( 'canvasdrag', onEventSourceDrag ); + viewer.removeHandler( 'canvasrelease', onEventSourceRelease ); + viewer.removeHandler( 'canvasclick', onEventSourceClick ); - equal( dragsHandledEventSource, dragCount, "'canvas-drag' event count matches 'mousemove' event count (" + dragCount + ")" ); - equal( releasesHandledEventSource, releasesExpected, "'canvas-release' event count matches expected (" + releasesExpected + ")" ); - equal( clicksHandledEventSource, releasesExpected, "'canvas-click' event count matches expected (" + releasesExpected + ")" ); + equal( dragsHandledEventSource, dragCount, "'canvasdrag' event count matches 'mousemove' event count (" + dragCount + ")" ); + equal( releasesHandledEventSource, releasesExpected, "'canvasrelease' event count matches expected (" + releasesExpected + ")" ); + equal( clicksHandledEventSource, releasesExpected, "'canvasclick' event count matches expected (" + releasesExpected + ")" ); equal( originalEventsPassedMouseTracker, eventsHandledMouseTracker, "Original event received count matches expected (" + eventsHandledMouseTracker + ")" ); deepEqual( eventData.userData, originalUserData, 'MouseTracker userData was untouched' ); diff --git a/test/formats.js b/test/formats.js index 0c673bcf..085e3712 100644 --- a/test/formats.js +++ b/test/formats.js @@ -29,11 +29,11 @@ var openHandler = function(eventSender, eventData) { viewer.removeHandler('open', openHandler); ok(true, 'Open event was sent'); - viewer.addHandler('tile-drawn', tileDrawnHandler); + viewer.addHandler('tiledrawn', tileDrawnHandler); }; var tileDrawnHandler = function(eventSender, eventData) { - viewer.removeHandler('tile-drawn', tileDrawnHandler); + viewer.removeHandler('tiledrawn', tileDrawnHandler); ok(true, 'A tile has been drawn'); viewer.addHandler('close', closeHandler); viewer.close(); diff --git a/test/strings.js b/test/strings.js index 1c740a8a..0cc0d8d4 100644 --- a/test/strings.js +++ b/test/strings.js @@ -15,7 +15,7 @@ }); test("getStringWithPlaceholders", function() { - equal(OpenSeadragon.getString("Errors.Open-Failed", "foo", "bar"), + equal(OpenSeadragon.getString("Errors.OpenFailed", "foo", "bar"), "Unable to open foo: bar", "String placeholder replacement"); });