diff --git a/examples/al-moc-sdss9.html b/examples/al-moc-sdss9.html index 56d32c55..ece20051 100644 --- a/examples/al-moc-sdss9.html +++ b/examples/al-moc-sdss9.html @@ -12,7 +12,7 @@ let aladin; A.init.then(() => { aladin = A.aladin('#aladin-lite-div', {target: '00 00 00 +07 00 00', fov: 130, survey: 'P/Mellinger/color'}); - var moc11 = A.MOCFromURL('http://skies.esac.esa.int/HST/NICMOS/Moc.fits', {color: '#84f', lineWidth: 3, fill: true}, (moc) => { + var moc11 = A.MOCFromURL('http://skies.esac.esa.int/HST/NICMOS/Moc.fits', {color: '#84f', lineWidth: 3, perimeter: true}, (moc) => { // moc is ready console.log(moc.contains(205.9019247, +2.4492764)); console.log(moc.contains(-205.9019247, +2.4492764)); diff --git a/src/js/Aladin.js b/src/js/Aladin.js index 56c50b4d..f71a2170 100644 --- a/src/js/Aladin.js +++ b/src/js/Aladin.js @@ -134,6 +134,38 @@ import { CooFrame } from './gui/Input/CooFrame'; * @property {boolean} [pixelateCanvas=true] - Whether to pixelate the canvas. */ +/** + * @typedef {Object} CircleSelection + * @description Options for configuring the Aladin Lite instance. + * + * @property {number} x - x coordinate of the center's circle in pixels + * @property {number} y - y coordinate of the center's circle in pixels + * @property {number} r - radius of the circle in pixels + * @property {function} contains - function taking a {x, y} object telling if the vertex is contained or not + * @property {function} bbox - returns the bbox of the selection in pixels + */ + +/** + * @typedef {Object} RectSelection + * @description Options for configuring the Aladin Lite instance. + * + * @property {number} x - top left x coordinate of the rectangle in pixels + * @property {number} y - top left y coordinate of the rectangle in pixels + * @property {number} w - width of the selection in pixels + * @property {number} h - height of the selection in pixels + * @property {function} contains - function taking a {x, y} object telling if the vertex is contained in the selection or not + * @property {function} bbox - returns the bbox of the selection in pixels + */ + +/** + * @typedef {Object} PolygonSelection + * @description Options for configuring the Aladin Lite instance. + * + * @property {Object[]} vertices - vertices of the polygon selection in pixels. Each vertex has a x and y key in pixels. + * @property {function} contains - function taking a {x, y} object telling if the vertex is contained in the selection or not + * @property {function} bbox - returns the bbox of the selection in pixels + */ + /** * @typedef {string} CooFrame * String with possible values: 'equatorial', 'ICRS', 'ICRSd', 'j2000', 'gal, 'galactic' @@ -1525,8 +1557,12 @@ export let Aladin = (function () { * Enters selection mode * * @memberof Aladin - * @param {string} mode=rect - The mode of selection, can be either, 'rect', 'poly', or 'circle' - * @param {function} callback - A function called once the selection has been done + * @param {string} [mode='rect'] - The mode of selection, can be either, 'rect', 'poly', or 'circle' + * @param {function} [callback] - A function called once the selection has been done + * The callback accepts one parameter depending of the mode used:
+ * - If mode='circle' that parameter is of type {@link CircleSelection}
+ * - If mode='rect' that parameter is of type {@link RectSelection}
+ * - If mode='poly' that parameter is of type {@link PolygonSelection} * * @example * // Creates and add a MOC from the user polygonal selection