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)
* Arrow key navigation fixed across platforms (#565)
* 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:

View File

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

View File

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

View File

@ -54,6 +54,9 @@
* @param {Element|String} options.element
* A reference to an element or an element id for which the pointer/key
* 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
* The number of milliseconds within which a pointer down-up event combination
* will be treated as a click gesture.
@ -257,6 +260,9 @@
currentPinchCenter: null
};
if ( !options.startDisabled ) {
this.setTracking( true );
}
};
$.MouseTracker.prototype = /** @lends OpenSeadragon.MouseTracker.prototype */{
@ -977,7 +983,8 @@
$.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)
$.MouseTracker.havePointerEvents = true;
$.MouseTracker.subscribeEvents.push( "pointerover", "pointerout", "pointerdown", "pointerup", "pointermove", "pointercancel" );
@ -988,7 +995,7 @@
$.MouseTracker.maxTouchPoints = 0;
}
$.MouseTracker.haveMouseEnter = false;
} else if ( window.MSPointerEvent ) {
} else if ( window.MSPointerEvent && window.navigator.msPointerEnabled ) {
// IE10
$.MouseTracker.havePointerEvents = true;
$.MouseTracker.subscribeEvents.push( "MSPointerOver", "MSPointerOut", "MSPointerDown", "MSPointerUp", "MSPointerMove", "MSPointerCancel" );
@ -1518,7 +1525,6 @@
propagate = tracker.keyDownHandler(
{
eventSource: tracker,
position: getMouseRelative( event, tracker.element ),
keyCode: event.keyCode ? event.keyCode : event.charCode,
ctrl: event.ctrlKey,
shift: event.shiftKey,
@ -1548,7 +1554,6 @@
propagate = tracker.keyUpHandler(
{
eventSource: tracker,
position: getMouseRelative( event, tracker.element ),
keyCode: event.keyCode ? event.keyCode : event.charCode,
ctrl: event.ctrlKey,
shift: event.shiftKey,
@ -1578,7 +1583,6 @@
propagate = tracker.keyHandler(
{
eventSource: tracker,
position: getMouseRelative( event, tracker.element ),
keyCode: event.keyCode ? event.keyCode : event.charCode,
ctrl: event.ctrlKey,
shift: event.shiftKey,

View File

@ -52,8 +52,7 @@ $.Navigator = function( options ){
var viewer = options.viewer,
_this = this,
viewerSize,
navigatorSize,
unneededElement;
navigatorSize;
//We may need to create a new element and id if they did not
//provide the id for the existing element
@ -99,6 +98,7 @@ $.Navigator = function( options ){
sizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio
}, options, {
element: this.element,
tabIndex: -1, // No keyboard navigation, omit from tab order
//These need to be overridden to prevent recursion since
//the navigator is a viewer and a viewer has a navigator
showNavigator: false,
@ -168,24 +168,6 @@ $.Navigator = function( options ){
this.displayRegionContainer.style.width = "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(
this.element,
options.controlOptions
@ -214,10 +196,6 @@ $.Navigator = function( options ){
this.displayRegionContainer.appendChild(this.displayRegion);
this.element.getElementsByTagName('div')[0].appendChild(this.displayRegionContainer);
unneededElement = this.element.getElementsByTagName('textarea')[0];
if (unneededElement) {
unneededElement.parentNode.removeChild(unneededElement);
}
if (options.navigatorRotate) {
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() {
if (_this.viewport) {
_this.viewport.goHome(true);

View File

@ -130,6 +130,10 @@
* Tile source(s) to open initially. This is a complex parameter; see
* {@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
* the viewer. The overlays added via this option and later removed with
* {@link OpenSeadragon.Viewer#removeOverlay} will be added back when a new

View File

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

View File

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

View File

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