fix hover line thickness

This commit is contained in:
Matthieu Baumann
2023-08-24 23:25:14 +02:00
committed by Matthieu Baumann
parent 479918c9b8
commit d55f47fcf6
6 changed files with 42 additions and 12 deletions

View File

@@ -160,6 +160,7 @@
text-overflow: ellipsis;
text-align: left;
color: #000;
max-width: 150px;
}
.aladin-marker-measurement {

View File

@@ -84,6 +84,10 @@ export let Circle = (function() {
}
};
Circle.prototype.getLineWidth = function() {
return this.lineWidth;
};
Circle.prototype.setOverlay = function(overlay) {
this.overlay = overlay;
};

View File

@@ -86,6 +86,10 @@ export let Ellipse = (function() {
}
};
Ellipse.prototype.getLineWidth = function() {
return this.lineWidth;
};
Ellipse.prototype.setOverlay = function(overlay) {
this.overlay = overlay;
};

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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++) {