From 8a3ec975961ab421d4165e454226dfb6c1f24330 Mon Sep 17 00:00:00 2001 From: houseofyin Date: Fri, 7 Jun 2013 10:24:12 -0400 Subject: [PATCH] Implemented and documented fallback behavior --- src/control.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/control.js b/src/control.js index 81af7819..36987b75 100644 --- a/src/control.js +++ b/src/control.js @@ -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;