Implemented and documented fallback behavior

This commit is contained in:
houseofyin 2013-06-07 10:24:12 -04:00
parent 7a8ebd7d4c
commit 8a3ec97596

View File

@ -54,7 +54,9 @@ $.ControlAnchor = {
* element.
* @class
* @param {Element} element - the control element to be anchored in the container.
* @param {Object} options - All required and optional settings for configuring a control element
* @param {Object | OpenSeadragon.ControlAnchor } options - All required and optional settings for configuring a control element. A deprecated
* alternative to passing an object with properties is to just pass an OpenSeadragon.ControlAnchor. The target
* removal date for this deprecated alternative is December 2013.
* @param {OpenSeadragon.ControlAnchor} [options.anchor=OpenSeadragon.ControlAnchor.NONE] - the position of the control
* relative to the container.
* @param {Boolean} [options.attachToViewer=true] - Whether the control should be added directly to the viewer, or
@ -74,6 +76,11 @@ $.ControlAnchor = {
*/
$.Control = function ( element, options, container ) {
var parent = element.parentNode;
//Deprecated. Target removal date is December 2013
if (typeof options === 'number')
{
options = {anchor: options};
}
options.attachToViewer = (typeof options.attachToViewer === 'undefined') ? true : options.attachToViewer;
this.autoFade = (typeof options.autoFade === 'undefined') ? true : options.autoFade;
this.element = element;