mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-12 15:49:18 -08:00
change u-strasbg to cds.unistra urls + enhance/simplify inertia effect
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# [Aladin Lite](https://aladin.u-strasbg.fr/AladinLite)
|
||||
# [Aladin Lite](https://aladin.cds.unistra.fr/AladinLite)
|
||||
|
||||
**An astronomical HiPS visualizer in the browser** <img src="aladin-logo.png" alt="Aladin Lite logo" width="220">
|
||||
|
||||
@@ -8,14 +8,14 @@ See [A&A 578, A114 (2015)](https://arxiv.org/abs/1505.02291) and [IVOA HiPS Reco
|
||||
|
||||
Aladin Lite is built to be easily embeddable in any web page. It powers astronomical portals like [ESASky](https://sky.esa.int/), [ESO Science Archive portal](http://archive.eso.org/scienceportal/) and [ALMA Portal](https://almascience.eso.org/asax/).
|
||||
|
||||
More details on [Aladin Lite documentation page](http://aladin.u-strasbg.fr/AladinLite/doc/).
|
||||
More details on [Aladin Lite documentation page](http://aladin.cds.unistra.fr/AladinLite/doc/).
|
||||
A new [API technical documentation](https://cds-astro.github.io/aladin-lite/) is now available.
|
||||
|
||||
[](https://github.com/cds-astro/aladin-lite/actions/workflows/test.yml)
|
||||
[](https://cds-astro.github.io/aladin-lite)
|
||||
[](https://aladin.cds.unistra.fr/AladinLite/doc/release/)
|
||||
|
||||
Try Aladin Lite [here](https://aladin.u-strasbg.fr/AladinLite).
|
||||
Try Aladin Lite [here](https://aladin.cds.unistra.fr/AladinLite).
|
||||
|
||||
Aladin Lite is made possible thanks to pure Rust core libraries:
|
||||
* [cdshealpix](https://github.com/cds-astro/cds-healpix-rust) - for HEALPix projection and unprojection to/from sky coordinates
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"homepage": "https://aladin.u-strasbg.fr/",
|
||||
"homepage": "https://aladin.cds.unistra.fr/",
|
||||
"name": "aladin-lite",
|
||||
"type": "module",
|
||||
"version": "3.7.2-beta",
|
||||
|
||||
@@ -87,6 +87,7 @@ pub struct App {
|
||||
time_start_dragging: Time,
|
||||
time_mouse_high_vel: Time,
|
||||
dragging: bool,
|
||||
vel_history: Vec<f32>,
|
||||
|
||||
prev_cam_position: Vector3<f64>,
|
||||
//prev_center: Vector3<f64>,
|
||||
@@ -208,6 +209,7 @@ impl App {
|
||||
|
||||
let browser_features_support = BrowserFeaturesSupport::new();
|
||||
|
||||
let vel_history = vec![];
|
||||
Ok(App {
|
||||
gl,
|
||||
//ui,
|
||||
@@ -244,6 +246,7 @@ impl App {
|
||||
time_start_dragging,
|
||||
time_mouse_high_vel,
|
||||
dragging,
|
||||
vel_history,
|
||||
|
||||
prev_cam_position,
|
||||
out_of_fov,
|
||||
@@ -1538,7 +1541,16 @@ impl App {
|
||||
let dx = crate::math::vector::dist2(&from_mouse_pos, &to_mouse_pos).sqrt();
|
||||
self.dist_dragging += dx;
|
||||
|
||||
//let now = Time::now();
|
||||
//let dragging_duration = (now - self.time_start_dragging).as_secs();
|
||||
//let dragging_vel = self.dist_dragging / dragging_duration;
|
||||
|
||||
// 1. Use smoothed velocity instead of instantaneous velocity
|
||||
let dv = dx / (Time::now() - self.camera.get_time_of_last_move()).as_secs();
|
||||
self.vel_history.push(dv);
|
||||
if self.vel_history.len() > 5 {
|
||||
self.vel_history.remove(0);
|
||||
}
|
||||
|
||||
if dv > 10000.0 {
|
||||
self.time_mouse_high_vel = Time::now();
|
||||
@@ -1587,15 +1599,18 @@ impl App {
|
||||
}
|
||||
|
||||
let now = Time::now();
|
||||
let dragging_duration = (now - self.time_start_dragging).as_secs();
|
||||
let dragging_vel = self.dist_dragging / dragging_duration;
|
||||
let avg_vel = self.vel_history.iter().copied().sum::<f32>() / self.vel_history.len() as f32;
|
||||
|
||||
// Detect if there has been a recent acceleration
|
||||
// It is also possible that the dragging time is too short and if it is the case, trigger the inertia
|
||||
let recent_acceleration = (Time::now() - self.time_mouse_high_vel).as_secs() < 0.1
|
||||
|| (Time::now() - self.time_start_dragging).as_secs() < 0.1;
|
||||
// 2. Clamp minimum + maximum velocities
|
||||
let min_vel = 1000.0; // tweak
|
||||
|
||||
if dragging_vel < 2000.0 && !recent_acceleration {
|
||||
// 3. Better condition for “recent acceleration”
|
||||
let t_since_drag = (now - self.time_start_dragging).as_secs();
|
||||
let t_since_accel = (now - self.time_mouse_high_vel).as_secs();
|
||||
|
||||
let inertia_trigger =
|
||||
avg_vel > min_vel || ((t_since_drag < 0.15) || (t_since_accel < 0.15));
|
||||
if !inertia_trigger {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1605,10 +1620,8 @@ impl App {
|
||||
let center = self.camera.get_center();
|
||||
let axis = self.prev_cam_position.cross(*center).normalize();
|
||||
|
||||
//let delta_time = ((now - time_of_last_move).0 as f64).max(1.0);
|
||||
let delta_angle = math::vector::angle3(&self.prev_cam_position, center).to_radians();
|
||||
let ampl = delta_angle * (dragging_vel as f64) * 5e-3;
|
||||
//let ampl = (dragging_vel * 0.01) as f64;
|
||||
let ampl = (delta_angle * avg_vel as f64) * 5e-3;
|
||||
|
||||
self.inertia = Some(Inertia::new(ampl.to_radians(), axis, self.north_up))
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ impl Inertia {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, _dt: DeltaTime) {
|
||||
let t = ((Time::now() - self.time_start).as_millis() / 1000.0) as f64;
|
||||
// Undamped angular frequency of the oscillator
|
||||
@@ -46,6 +47,24 @@ impl Inertia {
|
||||
let fov = start_fov * (1_f32 - alpha) + goal_fov * alpha;*/
|
||||
camera.apply_axis_rotation(&self.axis, self.speed.to_angle(), proj);
|
||||
|
||||
if self.north_up {
|
||||
camera.set_position_angle(0.0.to_angle(), proj);
|
||||
}
|
||||
}*/
|
||||
|
||||
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, _dt: DeltaTime) {
|
||||
let t = ((Time::now() - self.time_start).as_millis() / 1000.0) as f64;
|
||||
// Initial angular velocity
|
||||
let v0 = self.ampl * 0.5;
|
||||
|
||||
// Friction coefficient (tweak this)
|
||||
let damping = 2.5;
|
||||
|
||||
// Exponential decay of angular velocity
|
||||
self.speed = (v0 * (-damping * t).exp()).min(3.0);
|
||||
|
||||
camera.apply_axis_rotation(&self.axis, self.speed.to_angle(), proj);
|
||||
|
||||
if self.north_up {
|
||||
camera.set_position_angle(0.0.to_angle(), proj);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -362,7 +362,7 @@ A.graphicOverlay = function (options) {
|
||||
* @returns {ProgressiveCat} Returns a new Overlay object representing the graphic overlay.
|
||||
*
|
||||
* @example
|
||||
* let gaia = A.catalogHiPS('http://axel.u-strasbg.fr/HiPSCatService/I/345/gaia2', {onClick: 'showTable', color: 'orange', name: 'Gaia', filter: myFilterFunction});
|
||||
* let gaia = A.catalogHiPS('http://axel.cds.unistra.fr/HiPSCatService/I/345/gaia2', {onClick: 'showTable', color: 'orange', name: 'Gaia', filter: myFilterFunction});
|
||||
* aladin.addCatalog(gaia)
|
||||
*/
|
||||
A.catalogHiPS = function (url, options) {
|
||||
|
||||
@@ -941,7 +941,7 @@ export let Aladin = (function () {
|
||||
objectName +
|
||||
"'";
|
||||
var url =
|
||||
"//simbad.u-strasbg.fr/simbad/sim-tap/sync?query=" +
|
||||
"//simbad.cds.unistra.fr/simbad/sim-tap/sync?query=" +
|
||||
encodeURIComponent(query) +
|
||||
"&request=doQuery&lang=adql&format=json&phase=run";
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ export let SimbadPointer = (function() {
|
||||
if (Utils.isNumber(magnitude)) {
|
||||
content += '<em>Mag: </em>' + magnitude + '<br>';
|
||||
}
|
||||
content += '<br><a target="_blank" href="http://cdsportal.u-strasbg.fr/?target=' + encodeURIComponent(objName) + '">Query in CDS portal</a>';
|
||||
content += '<br><a target="_blank" href="http://cdsportal.cds.unistra.fr/?target=' + encodeURIComponent(objName) + '">Query in CDS portal</a>';
|
||||
content += '</div>';
|
||||
|
||||
aladinInstance.showPopup(objCoo.lon, objCoo.lat, title, content);
|
||||
|
||||
@@ -75,7 +75,7 @@ export class OverlayStackBox extends Box {
|
||||
};*/
|
||||
static predefinedCats = {
|
||||
simbad: {
|
||||
url: "https://axel.u-strasbg.fr/HiPSCatService/SIMBAD",
|
||||
url: "https://axel.cds.unistra.fr/HiPSCatService/SIMBAD",
|
||||
options: {
|
||||
id: "simbad",
|
||||
name: "SIMBAD",
|
||||
@@ -98,7 +98,7 @@ export class OverlayStackBox extends Box {
|
||||
},
|
||||
},
|
||||
gaia: {
|
||||
url: "https://axel.u-strasbg.fr/HiPSCatService/I/355/gaiadr3",
|
||||
url: "https://axel.cds.unistra.fr/HiPSCatService/I/355/gaiadr3",
|
||||
options: {
|
||||
id: "gaia-dr3",
|
||||
name: "Gaia DR3",
|
||||
@@ -109,7 +109,7 @@ export class OverlayStackBox extends Box {
|
||||
},
|
||||
},
|
||||
twomass: {
|
||||
url: "https://axel.u-strasbg.fr/HiPSCatService/II/246/out",
|
||||
url: "https://axel.cds.unistra.fr/HiPSCatService/II/246/out",
|
||||
options: {
|
||||
id: "2mass",
|
||||
name: "2MASS",
|
||||
@@ -790,7 +790,7 @@ export class OverlayStackBox extends Box {
|
||||
moreHiPSLink.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
if (!self.hipsBrowser)
|
||||
self.hipsBrowser = new HiPSBrowserBox(aladin);
|
||||
self.hipsBrowser = new HiPSBrowserBox(self.aladin);
|
||||
|
||||
self.hipsBrowser._show({ position: { anchor: "center center" } });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user