fix displacement bug when the inertia is triggered after a zoom/unzoom

This commit is contained in:
Matthieu Baumann
2026-01-22 16:55:03 +01:00
committed by Matthieu Baumann
parent 79e6a33d88
commit 94411f9ca9
9 changed files with 3669 additions and 3668 deletions
+13
View File
@@ -1605,6 +1605,10 @@ impl App {
return;
}
if self.vel_history.len() < 5 {
return;
}
let now = Time::now();
let avg_vel = self.vel_history.iter().copied().sum::<f32>() / self.vel_history.len() as f32;
@@ -1650,6 +1654,11 @@ impl App {
// For the moment, no animation is triggered.
// The fov is directly set
self.camera.set_aperture(fov, &self.projection);
// reset the parameters that determine if an inertia is needed
self.vel_history.clear();
self.dist_dragging = 0.0;
self.request_for_new_tiles = true;
self.request_redraw = true;
}
@@ -1807,6 +1816,10 @@ impl App {
pub(crate) fn set_zoom_factor(&mut self, zoom_factor: f64) {
self.camera.set_zoom_factor(zoom_factor, &self.projection);
// reset the parameters that determine if an inertia is needed
self.vel_history.clear();
self.dist_dragging = 0.0;
self._update_hips_location();
self.request_for_new_tiles = true;
+3635 -3635
View File
File diff suppressed because it is too large Load Diff
-5
View File
@@ -112,11 +112,6 @@ export let Footprint= (function() {
this.overlay.reportChange();
return;
}
/*let catalog = this.getCatalog();
if (catalog) {
catalog.view && catalog.view.requestRedraw();
}*/
};
Footprint.prototype.unhover = function() {
+1 -19
View File
@@ -906,25 +906,7 @@ export let View = (function () {
return;
}
var wasDragging = view.realDragging === true;
/*if (view.dragging) { // if we were dragging, reset to default cursor
if(view.mode === View.PAN) {
view.setCursor('default');
}
view.dragging = false;
if (wasDragging) {
view.realDragging = false;
// call the positionChanged once more with a dragging = false
view.throttledPositionChanged(false);
}
if (view.spectraDisplayer) {
view.spectraDisplayer.enableInteraction();
}
} // end of "if (view.dragging) ... "*/
var wasDragging = view.realDragging === true;
view.mustClearCatalog = true;
view.dragCoo = null;
+12 -8
View File
@@ -999,8 +999,9 @@ export class OverlayStackBox extends Box {
// remove HiPS cube player if any
aladin.removeUIByName("cube_displayer" + hips.layer)
if (hips instanceof HiPS && hips === aladin.view.spectraDisplayer.hips) {
aladin.view.spectraDisplayer.hide()
let spectraDisplayer = aladin.view.spectraDisplayer;
if (hips instanceof HiPS && spectraDisplayer && hips === spectraDisplayer.hips) {
spectraDisplayer.hide()
}
},
});
@@ -1039,9 +1040,12 @@ export class OverlayStackBox extends Box {
},
});
let settingsBox = new HiPSSettingsBox(self.aladin);
settingsBox.update({ layer: hips });
settingsBox._hide();
if (!this.settingsBox) {
this.settingsBox = new HiPSSettingsBox(self.aladin);
}
this.settingsBox.update({ layer: hips });
this.settingsBox._hide();
let settingsBtn = new TogglerActionButton({
icon: { url: settingsIconUrl, monochrome: true },
@@ -1061,7 +1065,7 @@ export class OverlayStackBox extends Box {
}
}
settingsBox._show({
this.settingsBox._show({
position: {
nextTo: settingsBtn,
direction: "right",
@@ -1070,7 +1074,7 @@ export class OverlayStackBox extends Box {
});
},
actionOff: (e) => {
settingsBox._hide();
this.settingsBox._hide();
},
});
@@ -1126,7 +1130,7 @@ export class OverlayStackBox extends Box {
if (!(hips.layer in self.ui)) {
self.ui[hips.layer] = {
HiPSSelector: HiPSselect,
settingsBox,
settingsBox: this.settingsBox,
settingsBtn,
showBtn,
};
+1 -1
View File
@@ -124,7 +124,7 @@ export class Tree extends DOMElement {
end: [
Input.checkbox({
name: "filter-out-not-in-view",
tooltip: { content: "Filter out data not in the view", position: {direction: "bottom"} },
tooltip: { content: "Mask data not in the view", position: {direction: "bottom"} },
checked: this.onlyInView,
click(e) {
self.onlyInView = e.target.checked;
+3
View File
@@ -159,6 +159,7 @@ export let Circle = (function() {
return;
}
this.isHovered = true;
this.setLineWidth(this.getLineWidth() + 2)
if (this.overlay) {
this.overlay.reportChange();
}
@@ -169,6 +170,8 @@ export let Circle = (function() {
return;
}
this.isHovered = false;
this.setLineWidth(this.getLineWidth() - 2)
if (this.overlay) {
this.overlay.reportChange();
}
+2
View File
@@ -164,6 +164,7 @@ export let Ellipse = (function() {
return;
}
this.isHovered = true;
this.setLineWidth(this.getLineWidth() + 2)
if (this.overlay) {
this.overlay.reportChange();
}
@@ -174,6 +175,7 @@ export let Ellipse = (function() {
return;
}
this.isHovered = false;
this.setLineWidth(this.getLineWidth() - 2)
if (this.overlay) {
this.overlay.reportChange();
}
+2
View File
@@ -149,6 +149,7 @@ export let Polyline = (function() {
return;
}
this.isHovered = true;
this.setLineWidth(this.getLineWidth() + 2)
if (this.overlay) {
this.overlay.reportChange();
}
@@ -159,6 +160,7 @@ export let Polyline = (function() {
return;
}
this.isHovered = false;
this.setLineWidth(this.getLineWidth() - 2)
if (this.overlay) {
this.overlay.reportChange();
}