fix Circle::intersectBbox

This commit is contained in:
Matthieu Baumann
2025-08-29 11:54:31 +02:00
parent 279f93c4ba
commit ac4af8fb18
5 changed files with 8 additions and 4 deletions

View File

@@ -45,7 +45,6 @@ export let DefaultActionsForContextMenu = (function () {
const a = aladinInstance;
const selectObjects = (selection) => {
console.log(selection)
a.view.selectObjects(selection);
};
return [

View File

@@ -251,7 +251,7 @@ export let Footprint= (function() {
return true;
}
}
return false;
return this.shapes.some((shape) => shape.intersectsBBox(x, y, w, h, view));
};
return Footprint;

View File

@@ -135,10 +135,12 @@ export class Selector {
}
// footprints
overlayItems = cat.getFootprints();
if (overlayItems) {
const {x, y, w, h} = selection.bbox();
for (var l = 0; l < overlayItems.length; l++) {
f = overlayItems[l];
if (f.intersectsBBox(x, y, w, h, view)) {
objListPerCatalog.push(f);
}

View File

@@ -328,9 +328,11 @@ export let Circle = (function() {
return false;
}
// compute the absolute distance between the middle of the bbox
// and the center of the circle
const circleDistance = {
x: Math.abs(centerXyview[0] - x),
y: Math.abs(centerXyview[1] - y)
x: Math.abs(centerXyview[0] - (x + w/2)),
y: Math.abs(centerXyview[1] - (y + h/2))
};
if (circleDistance.x > (w/2 + this.radius)) { return false; }

View File

@@ -346,6 +346,7 @@ export let Ellipse = (function() {
Ellipse.prototype.intersectsBBox = function(x, y, w, h) {
// todo
return false;
};
return Ellipse;