From 733f81fc6bd85db6a7fd8dbec4ed333785036702 Mon Sep 17 00:00:00 2001 From: Matthieu Baumann Date: Mon, 23 Oct 2023 10:00:13 +0200 Subject: [PATCH] big circle draw fix for #126. Try to make the source inside the circle --- examples/al-big-circle.html | 9 ++++++--- src/js/Circle.js | 10 +++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/al-big-circle.html b/examples/al-big-circle.html index 827d0458e..0602f1cf6 100644 --- a/examples/al-big-circle.html +++ b/examples/al-big-circle.html @@ -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) diff --git a/src/js/Circle.js b/src/js/Circle.js index 0c495ace3..57445276c 100644 --- a/src/js/Circle.js +++ b/src/js/Circle.js @@ -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;