diff --git a/src/js/Aladin.js b/src/js/Aladin.js index d95cc7cc..33696afa 100644 --- a/src/js/Aladin.js +++ b/src/js/Aladin.js @@ -2154,15 +2154,16 @@ aladin.on("positionChanged", ({ra, dec}) => { }; /** - * Return the current view as a data URL (base64-formatted string) - * Parameters: - * - options (optional): object with attributs - * * format (optional): 'image/png' or 'image/jpeg' - * * width: width in pixels of the image to output - * * height: height in pixels of the image to output - * * logo (optional): boolean to display the Aladin Lite logo + * Return the current view as a png data URL (base64-formatted string) * - * @API + * @memberof Aladin + * + * @param {Object} [options] (optional): object with attributs, options are: + * * format (optional): 'image/png' or 'image/jpeg' + * * width: width in pixels of the image to output + * * height: height in pixels of the image to output + * * logo (optional): boolean to display the Aladin Lite logo + * @returns {Promise} The image as a png data URL */ Aladin.prototype.getViewDataURL = async function (options) { var options = options || {}; @@ -2182,34 +2183,34 @@ aladin.on("positionChanged", ({ra, dec}) => { /** * Return the current view as a png ArrayBuffer - * Parameters : - * - withLogo (optional): boolean to display the Aladin Lite logo * - * @API + * @memberof Aladin + * + * @param {boolean} withLogo Display or not the Aladin Lite logo + * @returns {Promise} The image as a png ArrayBuffer */ Aladin.prototype.getViewArrayBuffer = async function (withLogo) { return await this.view.getCanvasArrayBuffer("image/png", null, null, withLogo); } /** - * Return the current view as a the desired data type - * Parameters : - * - dataType: 'url', 'arraybuffer', 'blob' - * - imgType: 'image/png', 'image/jpeg' - * - width: width in pixels of the image to output - * - height: height in pixels of the image to output - * - withLogo: boolean to display the Aladin Lite logo + * Return the current view as a png Blob * - * @API + * @memberof Aladin + * + * @param {string} dataType The type of data to return. Can be 'url', 'arraybuffer' or 'blob' + * @param {string} imgType The type of image to return. Can be 'image/png' or 'image/jpeg' + * @param {boolean} [withLogo] Display or not the Aladin Lite logo + * @returns {Promise} */ - View.prototype.getViewData = async function (dataType, imgType, width, height, withLogo=true){ + Aladin.prototype.getViewData = async function (dataType, imgType, withLogo=true){ switch (dataType) { case "url": - return await this.getCanvasDataURL(imgType, width, height, withLogo); + return await this.view.getCanvasDataURL(imgType, null, null, withLogo); case "arraybuffer": - return await this.getCanvasArrayBuffer(imgType, width, height, withLogo); + return await this.view.getCanvasArrayBuffer(imgType, null, null, withLogo); case "blob": - return await this.getCanvasBlob(imgType, width, height, withLogo); + return await this.view.getCanvasBlob(imgType, null, null, withLogo); default: throw new Error("Unknown data type: " + dataType); }