mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-12 07:40:26 -08:00
big circle draw fix for #126. Try to make the source inside the circle
This commit is contained in:
@@ -10,11 +10,14 @@
|
||||
import A from '../src/js/A.js';
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
// Start up Aladin Lite
|
||||
aladin = A.aladin('#aladin-lite-div', {survey: "CDS/P/DSS2/color", target: 'M 1', fov: 0.2, showContextMenu: true, fullScreen: true});
|
||||
aladin = A.aladin('#aladin-lite-div', {target: 'M 1', fov: 180});
|
||||
|
||||
var overlay = A.graphicOverlay({color: '#ee2345', lineWidth: 3});
|
||||
aladin.addOverlay(overlay);
|
||||
overlay.add(A.circle(83.66067, 22.03081, 40.0, {color: 'cyan'})); // radius in degrees
|
||||
overlay.add(A.circle(83.66067, 0, 30, {color: 'cyan'})); // radius in degrees
|
||||
var cat = A.catalog({name: 'Some markers', sourceSize: 18});
|
||||
aladin.addCatalog(cat);
|
||||
cat.addSources([A.marker(83, 29, {popupTitle: 'Point1', popupDesc: 'Does not show up in circle'})]);
|
||||
|
||||
aladin.on("footprintClicked", (footprint) => {
|
||||
console.log("footprint clicked catched", footprint)
|
||||
|
||||
@@ -167,8 +167,8 @@ export let Circle = (function() {
|
||||
let hidden = true;
|
||||
|
||||
var ra, dec, vertOnCircle, dx, dy;
|
||||
if (view.fov > 90) {
|
||||
this.radius = Number.POSITIVE_INFINITY;
|
||||
//if (this.radiusDegrees > 30) {
|
||||
this.radius = Number.NEGATIVE_INFINITY;
|
||||
|
||||
// Project 4 points lying on the circle and take the minimal dist with the center as radius
|
||||
[[-1, 0], [1, 0], [0, -1], [0, 1]].forEach(([cardDirRa, cardDirDec]) => {
|
||||
@@ -181,12 +181,12 @@ export let Circle = (function() {
|
||||
dx = vertOnCircle[0] - this.center.x;
|
||||
dy = vertOnCircle[1] - this.center.y;
|
||||
|
||||
this.radius = Math.min(Math.sqrt(dx*dx + dy*dy), this.radius);
|
||||
this.radius = Math.max(Math.sqrt(dx*dx + dy*dy), this.radius);
|
||||
|
||||
hidden = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
/*} else {
|
||||
ra = this.centerRaDec[0] + this.radiusDegrees;
|
||||
dec = this.centerRaDec[1];
|
||||
|
||||
@@ -199,7 +199,7 @@ export let Circle = (function() {
|
||||
this.radius = Math.sqrt(dx*dx + dy*dy);
|
||||
hidden = false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (hidden) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user