diff --git a/src/css/aladin.css b/src/css/aladin.css index c579e790..a23837c7 100644 --- a/src/css/aladin.css +++ b/src/css/aladin.css @@ -160,6 +160,7 @@ text-overflow: ellipsis; text-align: left; color: #000; + max-width: 150px; } .aladin-marker-measurement { diff --git a/src/js/Circle.js b/src/js/Circle.js index 57445276..5e61d024 100644 --- a/src/js/Circle.js +++ b/src/js/Circle.js @@ -84,6 +84,10 @@ export let Circle = (function() { } }; + Circle.prototype.getLineWidth = function() { + return this.lineWidth; + }; + Circle.prototype.setOverlay = function(overlay) { this.overlay = overlay; }; diff --git a/src/js/Ellipse.js b/src/js/Ellipse.js index 599cfb7a..4e8e0c63 100644 --- a/src/js/Ellipse.js +++ b/src/js/Ellipse.js @@ -86,6 +86,10 @@ export let Ellipse = (function() { } }; + Ellipse.prototype.getLineWidth = function() { + return this.lineWidth; + }; + Ellipse.prototype.setOverlay = function(overlay) { this.overlay = overlay; }; diff --git a/src/js/Footprint.js b/src/js/Footprint.js index b9b61918..24317970 100644 --- a/src/js/Footprint.js +++ b/src/js/Footprint.js @@ -83,7 +83,13 @@ export let Footprint= (function() { }; Footprint.prototype.setLineWidth = function(lineWidth) { - this.shapes.forEach((shape) => shape.setLineWidth()) + this.shapes.forEach((shape) => shape.setLineWidth(lineWidth)) + }; + + Footprint.prototype.getLineWidth = function() { + if (this.shapes && this.shapes.length > 0) { + return this.shapes[0].getLineWidth(); + } }; Footprint.prototype.setColor = function(color) { diff --git a/src/js/Polyline.js b/src/js/Polyline.js index 9299e482..5670e088 100644 --- a/src/js/Polyline.js +++ b/src/js/Polyline.js @@ -37,7 +37,7 @@ import { AladinUtils } from './AladinUtils.js'; import { Line } from './Line.js'; import { Utils } from './Utils'; import { Overlay } from "./Overlay.js"; -import { ProjectionEnum, projectionNames } from "./ProjectionEnum.js"; +import { ProjectionEnum } from "./ProjectionEnum.js"; export let Polyline= (function() { @@ -146,10 +146,15 @@ export let Polyline= (function() { } }; + Polyline.prototype.getLineWidth = function() { + return this.lineWidth; + }; + Polyline.prototype.setLineWidth = function(lineWidth) { if (this.lineWidth == lineWidth) { return; } + this.lineWidth = lineWidth; if (this.overlay) { this.overlay.reportChange(); @@ -388,6 +393,8 @@ export let Polyline= (function() { }; Polyline.prototype.isInStroke = function(ctx, view, x, y) { + ctx.lineWidth = this.lineWidth; + let pointXY = []; for (var j = 0; j < this.radecArray.length; j++) { var xy = AladinUtils.radecToViewXy(this.radecArray[j][0], this.radecArray[j][1], view); diff --git a/src/js/View.js b/src/js/View.js index b7957312..3fddfb5e 100644 --- a/src/js/View.js +++ b/src/js/View.js @@ -1221,16 +1221,18 @@ export let View = (function () { }; View.prototype.hideSelectedObjects = function() { + this.aladin.measurementTable.hide(); + if (this.selectedObjects) { this.selectedObjects.forEach((objList) => { objList.forEach((o) => o.deselect()) }); - this.aladin.measurementTable.hide(); this.selectedObjects = null; - - this.requestRedraw(); } + + this.requestRedraw(); + //} } View.prototype.showSelectedObjects = function() { @@ -1999,9 +2001,16 @@ export let View = (function () { footprints.forEach((footprint) => { // Hidden footprints are not considered + let lineWidth = footprint.getLineWidth(); + + footprint.setLineWidth(6.0); if (footprint.isShowing && footprint.isInStroke(ctx, this, x, y)) { closest = footprint; - return; + } + footprint.setLineWidth(lineWidth); + + if (closest) { + return closest; } }) @@ -2015,8 +2024,7 @@ export let View = (function () { var canvas = this.catalogCanvas; var ctx = canvas.getContext("2d"); // this makes footprint selection easier as the catch-zone is larger - let pastLineWidth = ctx.lineWidth; - ctx.lineWidth = 6.0; + //let pastLineWidth = ctx.lineWidth; if (this.overlays) { for (var k = 0; k < this.overlays.length; k++) { @@ -2024,7 +2032,7 @@ export let View = (function () { let closest = this.closestFootprints(overlay.overlayItems, ctx, x, y); if (closest) { - ctx.lineWidth = pastLineWidth; + //ctx.lineWidth = pastLineWidth; return [closest]; } } @@ -2037,18 +2045,18 @@ export let View = (function () { let closest = this.closestFootprints(catalog.footprints, ctx, x, y); if (closest) { - ctx.lineWidth = pastLineWidth; + //ctx.lineWidth = pastLineWidth; return [closest]; } } } if (!this.objLookup) { - ctx.lineWidth = pastLineWidth; + //ctx.lineWidth = pastLineWidth; return null; } - ctx.lineWidth = pastLineWidth; + //ctx.lineWidth = pastLineWidth; var closest, dist; for (var r = 0; r <= maxRadius; r++) {