MouseTracker now defaults to tracking on (#558)

This commit is contained in:
Mark Salsbery 2015-01-20 18:35:58 -08:00
parent 54ad0502e7
commit 545997bace
8 changed files with 22 additions and 10 deletions

View File

@ -21,6 +21,7 @@ OPENSEADRAGON CHANGELOG
* 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) * Removed 'position' property from MouseTracker keyDownHandler/keyUpHandler/keyHandler functions (#573)
* MouseTracker now defaults to tracking on (#558)
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 */{

View File

@ -174,16 +174,17 @@ $.Navigator = function( options ){
clickHandler: $.delegate( this, onCanvasClick ), clickHandler: $.delegate( this, onCanvasClick ),
releaseHandler: $.delegate( this, onCanvasRelease ), releaseHandler: $.delegate( this, onCanvasRelease ),
scrollHandler: $.delegate( this, onCanvasScroll ) scrollHandler: $.delegate( this, onCanvasScroll )
}).setTracking( true ); });
/*this.displayRegion.outerTracker = new $.MouseTracker({ /*this.displayRegion.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,
enterHandler: $.delegate( this, onContainerEnter ), enterHandler: $.delegate( this, onContainerEnter ),
exitHandler: $.delegate( this, onContainerExit ), exitHandler: $.delegate( this, onContainerExit ),
releaseHandler: $.delegate( this, onContainerRelease ) releaseHandler: $.delegate( this, onContainerRelease )
}).setTracking( this.mouseNavEnabled ? true : false ); // always tracking*/ });*/
viewer.addControl( viewer.addControl(

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 );
@ -447,8 +447,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

@ -297,6 +297,7 @@ $.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,
@ -316,17 +317,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 });

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,