Customize select logic

This commit is contained in:
Philip Matsson
2024-07-11 17:35:00 +02:00
committed by Matthieu Baumann
parent 3fb4a6493a
commit 00c9d6ffc5

View File

@@ -577,7 +577,7 @@ export let View = (function () {
const xymouse = Utils.relMouseCoords(e);
// deselect all the selected sources with Select panel
view.unselectObjects()
//view.unselectObjects()
try {
const [lon, lat] = view.aladin.pix2world(xymouse.x, xymouse.y, 'icrs');
@@ -620,8 +620,6 @@ export let View = (function () {
var handleSelect = function(xy, tolerance) {
tolerance = tolerance || 5;
var objs = view.closestObjects(xy.x, xy.y, tolerance);
// Deselect objects if any
view.unselectObjects();
if (objs) {
var objClickedFunction = view.aladin.callbacksByEventName['objectClicked'];
@@ -642,7 +640,7 @@ export let View = (function () {
(typeof objClickedFunction === 'function') && objClickedFunction(o, xy);
if (o.isFootprint()) {
if (typeof footprintClickedFunction === 'function' && (!view.lastClickedObject || !view.lastClickedObject.includes(o))) {
if (typeof footprintClickedFunction === 'function') {
footprintClickedFunction(o, xy);
}
}
@@ -650,7 +648,6 @@ export let View = (function () {
// rewrite objs
objs = Array.from(Object.values(objsByCats));
view.selectObjects(objs);
view.lastClickedObject = objs;
} else {
// If there is a past clicked object
@@ -1468,7 +1465,7 @@ export let View = (function () {
View.prototype.selectObjects = function(selection) {
// unselect the previous selection
this.unselectObjects();
//this.unselectObjects();
if (Array.isArray(selection)) {
this.selection = selection;