mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2026-06-12 11:01:37 -07:00
fix #352
This commit is contained in:
+15
-13
@@ -143,19 +143,6 @@ export let Catalog = (function () {
|
||||
// cacheCanvas permet de ne créer le path de la source qu'une fois, et de le réutiliser (cf. http://simonsarris.com/blog/427-increasing-performance-by-caching-paths-on-canvas)
|
||||
this.updateShape(options);
|
||||
|
||||
this.cacheMarkerCanvas = document.createElement("canvas");
|
||||
this.cacheMarkerCanvas.width = this.markerSize;
|
||||
this.cacheMarkerCanvas.height = this.markerSize;
|
||||
var cacheMarkerCtx = this.cacheMarkerCanvas.getContext("2d");
|
||||
cacheMarkerCtx.fillStyle = this.color;
|
||||
cacheMarkerCtx.beginPath();
|
||||
var half = this.markerSize / 2;
|
||||
cacheMarkerCtx.arc(half, half, half - 2, 0, 2 * Math.PI, false);
|
||||
cacheMarkerCtx.fill();
|
||||
cacheMarkerCtx.lineWidth = 2;
|
||||
cacheMarkerCtx.strokeStyle = "#ccc";
|
||||
cacheMarkerCtx.stroke();
|
||||
|
||||
this.isShowing = true;
|
||||
}
|
||||
|
||||
@@ -518,6 +505,21 @@ export let Catalog = (function () {
|
||||
this.hoverColor = options.hoverColor || this.hoverColor || undefined;
|
||||
this.sourceSize = options.sourceSize || this.sourceSize || 6;
|
||||
this.shape = options.shape || this.shape || "square";
|
||||
|
||||
this.markerSize = this.sourceSize;
|
||||
this.cacheMarkerCanvas = document.createElement("canvas");
|
||||
this.cacheMarkerCanvas.width = this.markerSize;
|
||||
this.cacheMarkerCanvas.height = this.markerSize;
|
||||
var cacheMarkerCtx = this.cacheMarkerCanvas.getContext("2d");
|
||||
cacheMarkerCtx.fillStyle = this.color;
|
||||
cacheMarkerCtx.beginPath();
|
||||
var half = this.markerSize / 2;
|
||||
cacheMarkerCtx.arc(half, half, half - 2, 0, 2 * Math.PI, false);
|
||||
cacheMarkerCtx.fill();
|
||||
cacheMarkerCtx.lineWidth = 2;
|
||||
cacheMarkerCtx.strokeStyle = '#ccc';
|
||||
cacheMarkerCtx.stroke();
|
||||
|
||||
if (typeof this.shape === "function") {
|
||||
this.shapeFn = this.shape;
|
||||
this.shape = "custom"
|
||||
|
||||
+22
-1
@@ -29,6 +29,25 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} SourceOptions
|
||||
* @description Options for describing a source
|
||||
*
|
||||
* @property {boolean} [marker=false] - If the source is a marker. A source marker is associated to a popup that is shown when clicking on it.
|
||||
* @property {string} [popupTitle=''] - Only for marker. The title of the popup.
|
||||
* @property {string} [popupDesc=''] - Only for marker. The content of the popup.
|
||||
* @property {number} [useMarkerDefaultIcon=true] - Only for marker. Set to false to use the regular shape option from the catalog and not the specific marker shape.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MarkerOptions
|
||||
* @description Options for describing a source marker
|
||||
*
|
||||
* @property {string} [popupTitle=''] - Only for marker. The title of the popup.
|
||||
* @property {string} [popupDesc=''] - Only for marker. The content of the popup.
|
||||
* @property {number} [useMarkerDefaultIcon=true] - Only for marker. Set to false to use the regular shape option from the catalog and not the specific marker shape.
|
||||
*/
|
||||
export let Source = (function() {
|
||||
// constructor
|
||||
let Source = function(ra, dec, data, options) {
|
||||
@@ -179,7 +198,9 @@ export let Source = (function() {
|
||||
view.aladin.popup.setTitle(this.popupTitle);
|
||||
view.aladin.popup.setText(this.popupDesc);
|
||||
view.aladin.popup.setSource(this);
|
||||
view.aladin.popup.show();
|
||||
|
||||
if (this.popupDesc || this.popupTitle)
|
||||
view.aladin.popup.show();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user