Merge branch 'master' into collections

fixed Conflicts:
	src/navigator.js
	src/openseadragon.js
This commit is contained in:
Ian Gilman 2015-01-22 11:15:45 -08:00
commit 735fcc3e37
9 changed files with 44 additions and 46 deletions

View File

@ -60,6 +60,12 @@ OPENSEADRAGON CHANGELOG
* Requesting keyboard focus when viewer is clicked (#537) * Requesting keyboard focus when viewer is clicked (#537)
* Arrow key navigation fixed across platforms (#565) * Arrow key navigation fixed across platforms (#565)
* Removed textarea element from viewer DOM. Viewer.canvas now handles keyboard navigation (#569) * Removed textarea element from viewer DOM. Viewer.canvas now handles keyboard navigation (#569)
* Removed 'position' property from MouseTracker keyDownHandler/keyUpHandler/keyHandler functions (#573)
* Fixed pointer event model detection for IE 10 and IE 11 (#571)
* Added setMouseNavEnabled() support to Navigator (#572)
* MouseTracker now defaults to tracking on (#558)
* Removed Viewer focusHandler/onCanvasFocus (#577)
* Added tabIndex option to viewer (#577)
1.2.0: 1.2.0:

View File

@ -355,7 +355,7 @@ $.Button = function( options ) {
return true; return true;
} }
}).setTracking( true ); });
outTo( this, $.ButtonState.REST ); outTo( this, $.ButtonState.REST );
}; };

View File

@ -105,7 +105,7 @@ $.ButtonGroup = function( options ) {
} }
} }
}, },
}).setTracking( true ); });
}; };
$.ButtonGroup.prototype = /** @lends OpenSeadragon.ButtonGroup.prototype */{ $.ButtonGroup.prototype = /** @lends OpenSeadragon.ButtonGroup.prototype */{

View File

@ -54,6 +54,9 @@
* @param {Element|String} options.element * @param {Element|String} options.element
* A reference to an element or an element id for which the pointer/key * A reference to an element or an element id for which the pointer/key
* events will be monitored. * events will be monitored.
* @param {Boolean} [options.startDisabled=false]
* If true, event tracking on the element will not start until
* {@link OpenSeadragon.MouseTracker.setTracking|setTracking} is called.
* @param {Number} options.clickTimeThreshold * @param {Number} options.clickTimeThreshold
* The number of milliseconds within which a pointer down-up event combination * The number of milliseconds within which a pointer down-up event combination
* will be treated as a click gesture. * will be treated as a click gesture.
@ -257,6 +260,9 @@
currentPinchCenter: null currentPinchCenter: null
}; };
if ( !options.startDisabled ) {
this.setTracking( true );
}
}; };
$.MouseTracker.prototype = /** @lends OpenSeadragon.MouseTracker.prototype */{ $.MouseTracker.prototype = /** @lends OpenSeadragon.MouseTracker.prototype */{
@ -977,7 +983,8 @@
$.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" ); $.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
} }
if ( window.PointerEvent ) { // Note: window.navigator.pointerEnable is deprecated on IE 11 and not part of W3C spec.
if ( window.PointerEvent && ( window.navigator.pointerEnabled || $.Browser.vendor !== $.BROWSERS.IE ) ) {
// IE11 and other W3C Pointer Event implementations (see http://www.w3.org/TR/pointerevents) // IE11 and other W3C Pointer Event implementations (see http://www.w3.org/TR/pointerevents)
$.MouseTracker.havePointerEvents = true; $.MouseTracker.havePointerEvents = true;
$.MouseTracker.subscribeEvents.push( "pointerover", "pointerout", "pointerdown", "pointerup", "pointermove", "pointercancel" ); $.MouseTracker.subscribeEvents.push( "pointerover", "pointerout", "pointerdown", "pointerup", "pointermove", "pointercancel" );
@ -988,7 +995,7 @@
$.MouseTracker.maxTouchPoints = 0; $.MouseTracker.maxTouchPoints = 0;
} }
$.MouseTracker.haveMouseEnter = false; $.MouseTracker.haveMouseEnter = false;
} else if ( window.MSPointerEvent ) { } else if ( window.MSPointerEvent && window.navigator.msPointerEnabled ) {
// IE10 // IE10
$.MouseTracker.havePointerEvents = true; $.MouseTracker.havePointerEvents = true;
$.MouseTracker.subscribeEvents.push( "MSPointerOver", "MSPointerOut", "MSPointerDown", "MSPointerUp", "MSPointerMove", "MSPointerCancel" ); $.MouseTracker.subscribeEvents.push( "MSPointerOver", "MSPointerOut", "MSPointerDown", "MSPointerUp", "MSPointerMove", "MSPointerCancel" );
@ -1518,7 +1525,6 @@
propagate = tracker.keyDownHandler( propagate = tracker.keyDownHandler(
{ {
eventSource: tracker, eventSource: tracker,
position: getMouseRelative( event, tracker.element ),
keyCode: event.keyCode ? event.keyCode : event.charCode, keyCode: event.keyCode ? event.keyCode : event.charCode,
ctrl: event.ctrlKey, ctrl: event.ctrlKey,
shift: event.shiftKey, shift: event.shiftKey,
@ -1548,7 +1554,6 @@
propagate = tracker.keyUpHandler( propagate = tracker.keyUpHandler(
{ {
eventSource: tracker, eventSource: tracker,
position: getMouseRelative( event, tracker.element ),
keyCode: event.keyCode ? event.keyCode : event.charCode, keyCode: event.keyCode ? event.keyCode : event.charCode,
ctrl: event.ctrlKey, ctrl: event.ctrlKey,
shift: event.shiftKey, shift: event.shiftKey,
@ -1578,7 +1583,6 @@
propagate = tracker.keyHandler( propagate = tracker.keyHandler(
{ {
eventSource: tracker, eventSource: tracker,
position: getMouseRelative( event, tracker.element ),
keyCode: event.keyCode ? event.keyCode : event.charCode, keyCode: event.keyCode ? event.keyCode : event.charCode,
ctrl: event.ctrlKey, ctrl: event.ctrlKey,
shift: event.shiftKey, shift: event.shiftKey,

View File

@ -52,8 +52,7 @@ $.Navigator = function( options ){
var viewer = options.viewer, var viewer = options.viewer,
_this = this, _this = this,
viewerSize, viewerSize,
navigatorSize, navigatorSize;
unneededElement;
//We may need to create a new element and id if they did not //We may need to create a new element and id if they did not
//provide the id for the existing element //provide the id for the existing element
@ -99,6 +98,7 @@ $.Navigator = function( options ){
sizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio sizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio
}, options, { }, options, {
element: this.element, element: this.element,
tabIndex: -1, // No keyboard navigation, omit from tab order
//These need to be overridden to prevent recursion since //These need to be overridden to prevent recursion since
//the navigator is a viewer and a viewer has a navigator //the navigator is a viewer and a viewer has a navigator
showNavigator: false, showNavigator: false,
@ -168,24 +168,6 @@ $.Navigator = function( options ){
this.displayRegionContainer.style.width = "100%"; this.displayRegionContainer.style.width = "100%";
this.displayRegionContainer.style.height = "100%"; this.displayRegionContainer.style.height = "100%";
this.element.innerTracker = new $.MouseTracker({
element: this.element,
dragHandler: $.delegate( this, onCanvasDrag ),
clickHandler: $.delegate( this, onCanvasClick ),
releaseHandler: $.delegate( this, onCanvasRelease ),
scrollHandler: $.delegate( this, onCanvasScroll )
}).setTracking( true );
/*this.displayRegion.outerTracker = new $.MouseTracker({
element: this.container,
clickTimeThreshold: this.clickTimeThreshold,
clickDistThreshold: this.clickDistThreshold,
enterHandler: $.delegate( this, onContainerEnter ),
exitHandler: $.delegate( this, onContainerExit ),
releaseHandler: $.delegate( this, onContainerRelease )
}).setTracking( this.mouseNavEnabled ? true : false ); // always tracking*/
viewer.addControl( viewer.addControl(
this.element, this.element,
options.controlOptions options.controlOptions
@ -214,10 +196,6 @@ $.Navigator = function( options ){
this.displayRegionContainer.appendChild(this.displayRegion); this.displayRegionContainer.appendChild(this.displayRegion);
this.element.getElementsByTagName('div')[0].appendChild(this.displayRegionContainer); this.element.getElementsByTagName('div')[0].appendChild(this.displayRegionContainer);
unneededElement = this.element.getElementsByTagName('textarea')[0];
if (unneededElement) {
unneededElement.parentNode.removeChild(unneededElement);
}
if (options.navigatorRotate) { if (options.navigatorRotate) {
options.viewer.addHandler("rotate", function (args) { options.viewer.addHandler("rotate", function (args) {
@ -227,6 +205,16 @@ $.Navigator = function( options ){
}); });
} }
// Remove the base class' (Viewer's) innerTracker and replace it with our own
this.innerTracker.destroy();
this.innerTracker = new $.MouseTracker({
element: this.element,
dragHandler: $.delegate( this, onCanvasDrag ),
clickHandler: $.delegate( this, onCanvasClick ),
releaseHandler: $.delegate( this, onCanvasRelease ),
scrollHandler: $.delegate( this, onCanvasScroll )
});
this.addHandler("reset-size", function() { this.addHandler("reset-size", function() {
if (_this.viewport) { if (_this.viewport) {
_this.viewport.goHome(true); _this.viewport.goHome(true);

View File

@ -130,6 +130,10 @@
* Tile source(s) to open initially. This is a complex parameter; see * Tile source(s) to open initially. This is a complex parameter; see
* {@link OpenSeadragon.Viewer#open} for details. * {@link OpenSeadragon.Viewer#open} for details.
* *
* @property {Number} [tabIndex=0]
* Tabbing order index to assign to the viewer element. Positive values are selected in increasing order. When tabIndex is 0
* source order is used. A negative value omits the viewer from the tabbing order.
*
* @property {Array} overlays Array of objects defining permanent overlays of * @property {Array} overlays Array of objects defining permanent overlays of
* the viewer. The overlays added via this option and later removed with * the viewer. The overlays added via this option and later removed with
* {@link OpenSeadragon.Viewer#removeOverlay} will be added back when a new * {@link OpenSeadragon.Viewer#removeOverlay} will be added back when a new

View File

@ -127,7 +127,7 @@ $.ReferenceStrip = function ( options ) {
exitHandler: $.delegate( this, onStripExit ), exitHandler: $.delegate( this, onStripExit ),
keyDownHandler: $.delegate( this, onKeyDown ), keyDownHandler: $.delegate( this, onKeyDown ),
keyHandler: $.delegate( this, onKeyPress ) keyHandler: $.delegate( this, onKeyPress )
} ).setTracking( true ); } );
//Controls the position and orientation of the reference strip and sets the //Controls the position and orientation of the reference strip and sets the
//appropriate width and height //appropriate width and height
@ -215,7 +215,7 @@ $.ReferenceStrip = function ( options ) {
viewer.goToPage( page ); viewer.goToPage( page );
} }
} }
} ).setTracking( true ); } );
this.element.appendChild( element ); this.element.appendChild( element );
@ -454,8 +454,10 @@ function loadPanels( strip, viewerSize, scroll ) {
style.width = ( strip.panelWidth - 4 ) + 'px'; style.width = ( strip.panelWidth - 4 ) + 'px';
style.height = ( strip.panelHeight - 4 ) + 'px'; style.height = ( strip.panelHeight - 4 ) + 'px';
// TODO: What is this for? Future keyboard navigation support?
miniViewer.displayRegion.innerTracker = new $.MouseTracker( { miniViewer.displayRegion.innerTracker = new $.MouseTracker( {
element: miniViewer.displayRegion element: miniViewer.displayRegion,
startDisabled: true
} ); } );
element.getElementsByTagName( 'div' )[0].appendChild( element.getElementsByTagName( 'div' )[0].appendChild(

View File

@ -232,7 +232,7 @@ $.Viewer = function( options ) {
style.left = "0px"; style.left = "0px";
}(this.canvas.style)); }(this.canvas.style));
$.setElementTouchActionNone( this.canvas ); $.setElementTouchActionNone( this.canvas );
this.canvas.tabIndex = 0; this.canvas.tabIndex = options.tabIndex || 0;
//the container is created through applying the ControlDock constructor above //the container is created through applying the ControlDock constructor above
this.container.className = "openseadragon-container"; this.container.className = "openseadragon-container";
@ -259,11 +259,11 @@ $.Viewer = function( options ) {
this.innerTracker = new $.MouseTracker({ this.innerTracker = new $.MouseTracker({
element: this.canvas, element: this.canvas,
startDisabled: this.mouseNavEnabled ? false : true,
clickTimeThreshold: this.clickTimeThreshold, clickTimeThreshold: this.clickTimeThreshold,
clickDistThreshold: this.clickDistThreshold, clickDistThreshold: this.clickDistThreshold,
dblClickTimeThreshold: this.dblClickTimeThreshold, dblClickTimeThreshold: this.dblClickTimeThreshold,
dblClickDistThreshold: this.dblClickDistThreshold, dblClickDistThreshold: this.dblClickDistThreshold,
focusHandler: $.delegate( this, onCanvasFocus ),
keyDownHandler: $.delegate( this, onCanvasKeyDown ), keyDownHandler: $.delegate( this, onCanvasKeyDown ),
keyHandler: $.delegate( this, onCanvasKeyPress ), keyHandler: $.delegate( this, onCanvasKeyPress ),
clickHandler: $.delegate( this, onCanvasClick ), clickHandler: $.delegate( this, onCanvasClick ),
@ -278,17 +278,18 @@ $.Viewer = function( options ) {
nonPrimaryReleaseHandler: $.delegate( this, onCanvasNonPrimaryRelease ), nonPrimaryReleaseHandler: $.delegate( this, onCanvasNonPrimaryRelease ),
scrollHandler: $.delegate( this, onCanvasScroll ), scrollHandler: $.delegate( this, onCanvasScroll ),
pinchHandler: $.delegate( this, onCanvasPinch ) pinchHandler: $.delegate( this, onCanvasPinch )
}).setTracking( this.mouseNavEnabled ? true : false ); // default state });
this.outerTracker = new $.MouseTracker({ this.outerTracker = new $.MouseTracker({
element: this.container, element: this.container,
startDisabled: this.mouseNavEnabled ? false : true,
clickTimeThreshold: this.clickTimeThreshold, clickTimeThreshold: this.clickTimeThreshold,
clickDistThreshold: this.clickDistThreshold, clickDistThreshold: this.clickDistThreshold,
dblClickTimeThreshold: this.dblClickTimeThreshold, dblClickTimeThreshold: this.dblClickTimeThreshold,
dblClickDistThreshold: this.dblClickDistThreshold, dblClickDistThreshold: this.dblClickDistThreshold,
enterHandler: $.delegate( this, onContainerEnter ), enterHandler: $.delegate( this, onContainerEnter ),
exitHandler: $.delegate( this, onContainerExit ) exitHandler: $.delegate( this, onContainerExit )
}).setTracking( this.mouseNavEnabled ? true : false ); // always tracking });
if( this.toolbar ){ if( this.toolbar ){
this.toolbar = new $.ControlDock({ element: this.toolbar }); this.toolbar = new $.ControlDock({ element: this.toolbar });
@ -2185,13 +2186,6 @@ function onBlur(){
} }
function onCanvasFocus( event ) {
if ( !event.preventDefaultAction ) {
var point = $.getElementPosition( this.element );
window.scrollTo( 0, point.y );
}
}
function onCanvasKeyDown( event ) { function onCanvasKeyDown( event ) {
if ( !event.preventDefaultAction && !event.ctrl && !event.alt && !event.meta ) { if ( !event.preventDefaultAction && !event.ctrl && !event.alt && !event.meta ) {
switch( event.keyCode ){ switch( event.keyCode ){

View File

@ -790,7 +790,7 @@
releaseHandler: onMouseTrackerRelease, releaseHandler: onMouseTrackerRelease,
clickHandler: onMouseTrackerClick, clickHandler: onMouseTrackerClick,
exitHandler: onMouseTrackerExit exitHandler: onMouseTrackerExit
} ).setTracking( true ); } );
var event = { var event = {
clientX:1, clientX:1,