stack close btn

This commit is contained in:
Matthieu Baumann
2024-07-21 12:14:33 +02:00
parent 5a298f6ee1
commit 888aa6fc45
19 changed files with 60 additions and 63 deletions

View File

@@ -8,8 +8,8 @@
"dateModified": "2023-01-31",
"issueTracker": "https://github.com/cds-astro/aladin-lite/issues",
"name": "Aladin Lite",
"version": "3.4.4-beta",
"softwareVersion": "3.4.4-beta",
"version": "3.4.5-beta",
"softwareVersion": "3.4.5-beta",
"description": "An astronomical HiPS visualizer in the browser.",
"identifier": "10.5281/zenodo.7638833",
"applicationCategory": "Astronomy, Visualization",

View File

@@ -20,6 +20,7 @@
A.polygon([[8.62807, 220.06330], [83.58397, 10.02280], [150.62792, 87.02258]])
]);
overlay.add(A.circle(83.66067, 22.03081, 0.04, {color: 'cyan'})); // radius in degrees
overlay.add(A.vector(83.66067, 22.03081, 0.04, {color: 'cyan'})); // radius in degrees
aladin.on("footprintClicked", (footprint, xyMouseCoords) => {
console.log("footprint clicked catched: ", footprint, "mouse coords xy: ", xyMouseCoords.x, xyMouseCoords.y);

View File

@@ -16,8 +16,8 @@
imgFormat: 'jpeg',
wcs: {
NAXIS: 0, // Minimal header
CTYPE1: 'RA---TAN', // TAN (gnomic) projection + SIP distortions
CTYPE2: 'DEC--TAN', // TAN (gnomic) projection + SIP distortions
CTYPE1: 'RA---TAN', // TAN (gnomic) projection
CTYPE2: 'DEC--TAN', // TAN (gnomic) projection
EQUINOX: 2000.0, // Equatorial coordinates definition (yr)
LONPOLE: 180.0, // no comment
LATPOLE: 0.0, // no comment
@@ -41,6 +41,7 @@
},
));
});
</script>
</body>
</html>

View File

@@ -3,7 +3,7 @@ name = "aladin-lite"
description = "Aladin Lite v3 introduces a new graphical engine written in Rust with the use of WebGL"
license = "BSD-3-Clause"
repository = "https://github.com/cds-astro/aladin-lite"
version = "3.4.4-beta"
version = "3.4.5-beta"
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
edition = "2018"
@@ -26,7 +26,7 @@ wasm-bindgen = "0.2.79"
wasm-streams = "0.3.0"
async-channel = "1.8.0"
mapproj = "0.3.0"
fitsrs = "0.2.9"
fitsrs = "0.2.11"
colorgrad = "0.6.2"
[features]

View File

@@ -9,7 +9,7 @@ js-sys = "0.3.47"
cgmath = "*"
jpeg-decoder = "0.3.0"
png = "0.17.6"
fitsrs = "0.2.7"
fitsrs = "0.2.10"
al-api = { path = "../al-api" }
serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"

View File

@@ -953,7 +953,7 @@ impl App {
//&mut self.line_renderer,
)?;
self.line_renderer.begin();
//self.line_renderer.begin();
//Time::measure_perf("moc draw", || {
// Ok(())
@@ -961,9 +961,9 @@ impl App {
self.grid
.draw(&self.camera, &self.projection, &mut self.shaders)?;
self.line_renderer.end();
self.line_renderer
.draw(&mut self.shaders, &self.camera, &self.projection)?;
//self.line_renderer.end();
//self.line_renderer
// .draw(&mut self.shaders, &self.camera, &self.projection)?;
//let dpi = self.camera.get_dpi();
//ui.draw(&gl, dpi)?;

View File

@@ -293,7 +293,9 @@ impl ProjetedGrid {
);
let num_instances = buf.len() / 4;
let c = self.color.clone();
log!(c);
self.gl.enable(WebGl2RenderingContext::BLEND);
crate::shader::get_shader(&self.gl, shaders, "line_inst_ndc.vert", "line_base.frag")?
.bind(&self.gl)
.attach_uniform("u_color", &self.color)
@@ -306,6 +308,7 @@ impl ProjetedGrid {
0,
num_instances as i32,
);
self.gl.disable(WebGl2RenderingContext::BLEND);
}
Ok(())

View File

@@ -318,7 +318,7 @@ impl Image {
.unwrap() as f32;
// Create a WCS from a specific header unit
let wcs = WCS::from_fits_header(&header)
let wcs = WCS::from_fits_header(header)
.map_err(|e| JsValue::from_str(&format!("WCS parsing error: reason: {}", e)))?;
let data = hdu.get_data_mut();

View File

@@ -46,7 +46,7 @@ import { ProjectionEnum } from "./ProjectionEnum.js";
import { ALEvent } from "./events/ALEvent.js";
import { Color } from "./Color.js";
import { Image } from "./ImageFITS.js";
import { Image } from "./Image.js";
import { DefaultActionsForContextMenu } from "./DefaultActionsForContextMenu.js";
import { SAMPConnector } from "./vo/samp.js";
import { Reticle } from "./Reticle.js";

View File

@@ -438,15 +438,16 @@ export let ImageHiPS = (function () {
self.cooFrame == "j2000"
) {
self.cooFrame = "ICRS";
} else if (self.cooFrame == "galactic") {
} else if (self.cooFrame == "galactic" || self.cooFrame == "GAL") {
self.cooFrame = "GAL";
} else {
self.cooFrame = "ICRS";
console.warn(
"Invalid cooframe given: " +
self.cooFrame +
'. Coordinate systems supported: "ICRS", "ICRSd", "j2000" or "galactic". ICRS is chosen by default'
);
self.cooFrame = "ICRS";
}
self.formats = self.formats || [self.imgFormat];

View File

@@ -78,7 +78,7 @@ export let URLBuilder = (function() {
}
if (posParam) {
return 'https://ivoa.dachs.srcdev.skao.int/rucio/rucio/cone/form?__nevow_form__=genForm&hscs_pos=' + posParam + '&hscs_sr=' + encodeURIComponent(radiusDegrees * 60) + '&_FORMAT=VOTable&submit=Go';
return 'https://dachs.ivoa.srcdev.skao.int/rucio/rucio/cone/form?__nevow_form__=genForm&hscs_pos=' + posParam + '&hscs_sr=' + encodeURIComponent(radiusDegrees * 60) + '&_FORMAT=VOTable&submit=Go';
}
},

View File

@@ -49,7 +49,7 @@ import { Layout } from "./gui/Layout.js";
import { SAMPActionButton } from "./gui/Button/SAMP.js";
import { HiPSCache } from "./DefaultHiPSCache.js";
import { ImageHiPS } from "./ImageHiPS.js";
import { Image } from "./ImageFITS.js";
import { Image } from "./Image.js";
export let View = (function () {

View File

@@ -50,7 +50,7 @@ import { Icon } from "../Widgets/Icon.js";
import { Box } from "../Widgets/Box.js";
import { CtxMenuActionButtonOpener } from "../Button/CtxMenuOpener.js";
import { Input } from "../Widgets/Input.js";
import { Image } from "../../ImageFITS.js";
import { Image } from "../../Image.js";
import { HiPSCache } from "../../DefaultHiPSCache.js";
import { HiPSBrowserBox } from "./HiPSBrowserBox.js";
@@ -121,10 +121,10 @@ export class OverlayStackBox extends Box {
},
};
// Constructor
constructor(aladin) {
constructor(aladin, stackBtn) {
super(
{
close: false,
close: true,
header: {
title: "Stack",
},
@@ -133,6 +133,7 @@ export class OverlayStackBox extends Box {
},
aladin.aladinDiv
);
this.stackBtn = stackBtn;
this.cachedHiPS = {};
this.aladin = aladin;
@@ -742,6 +743,9 @@ export class OverlayStackBox extends Box {
if (this.addHiPSBtn) this.addHiPSBtn.hideMenu();
// toggle the button because the window is closed
this.stackBtn.update({toggled: false});
super._hide();
}
@@ -1156,5 +1160,7 @@ export class OverlayStackBox extends Box {
...options,
...{ position: this.position },
});
this.stackBtn.update({toggled: true});
}
}

View File

@@ -20,7 +20,8 @@
import { CtxMenuActionButtonOpener } from "./CtxMenuOpener";
import stackOverlayIconUrl from './../../../../assets/icons/stack.svg';
import { OverlayStackBox } from "../Box/StackBox";
import { TogglerActionButton } from "./Toggler";
import { ActionButton } from "./../Widgets/ActionButton";
/******************************************************************************
* Aladin Lite project
*
@@ -36,15 +37,14 @@ import { TogglerActionButton } from "./Toggler";
* Class representing a Tabs layout
* @extends CtxMenuActionButtonOpener
*/
export class OverlayStackButton extends TogglerActionButton {
export class OverlayStackButton extends ActionButton {
/**
* UI responsible for displaying the viewport infos
* @param {Aladin} aladin - The aladin instance.
*/
constructor(aladin, options) {
let self;
let stack = new OverlayStackBox(aladin);
let stack;
super({
icon: {
size: 'medium',
@@ -59,20 +59,21 @@ import { TogglerActionButton } from "./Toggler";
}
},
toggled: false,
actionOn: (e) => {
stack._show({
position: {
nextTo: self,
direction: 'right'
}
})
},
actionOff: (e) => {
stack._hide()
action(e) {
if (stack.isHidden) {
stack._show({
position: {
nextTo: self,
direction: 'right'
}
})
} else {
stack._hide()
}
},
...options
}, aladin);
});
self = this;
stack = new OverlayStackBox(aladin, self);
}
}

View File

@@ -43,6 +43,7 @@ export class TogglerActionButton extends ActionButton {
...options,
toggled,
action(o) {
options.action && options.action(o);
self.toggle(o);
}
})
@@ -57,6 +58,12 @@ export class TogglerActionButton extends ActionButton {
}
}
open() {
if (!this.toggled) {
this.toggle();
}
}
toggle(o) {
this.toggled = !this.toggled;

View File

@@ -60,9 +60,6 @@ export class SettingsCtxMenu extends ContextMenu {
value: reticleColor.toHex(),
name: 'reticleColor',
change(e) {
e.stopPropagation()
e.preventDefault();
let hex = e.target.value;
let reticle = aladin.getReticle();
reticle.update({color: hex})
@@ -156,7 +153,9 @@ export class SettingsCtxMenu extends ContextMenu {
//ProjectionCtxMenu.getLayout(self.aladin),
GridSettingsCtxMenu.getLayout(self.aladin),
{
label: 'Reticle',
label: {
content: ['Reticle']
},
subMenu: [
{
label: {

View File

@@ -47,7 +47,6 @@ export class Box extends DOMElement {
constructor(options, target, position = "beforeend") {
let el = document.createElement("div");
el.classList.add('aladin-box');
//el.style.display = "initial";
super(el, options);

View File

@@ -278,7 +278,6 @@ export class ContextMenu extends DOMElement {
opt.subMenu.forEach(subOpt => this._attachOption(subMenu, subOpt, e, cssStyle));
}
const areSiblings = (elm1, elm2) => (elm1 !== elm2 && elm1.parentNode == elm2.parentNode);
item.addEventListener('mouseover', e => {
e.stopPropagation();
e.preventDefault();
@@ -286,19 +285,6 @@ export class ContextMenu extends DOMElement {
if (opt.hover) {
opt.hover(e, item);
}
/*if (ContextMenu.lastHoveredItem) {
let parent = ContextMenu.lastHoveredItem.parentNode;
if (parent && (areSiblings(parent, item) || item.contains(parent) || item === parent)) {
ContextMenu.lastHoveredItem.style.display = 'none';
}
}
const subMenu = item.querySelector('.aladin-context-sub-menu');
if (subMenu) {
subMenu.style.display = 'block';
ContextMenu.lastHoveredItem = subMenu;
}*/
})
item.addEventListener('mouseout', e => {
@@ -339,13 +325,6 @@ export class ContextMenu extends DOMElement {
} else {
child.classList.add('top');
}
/*if (r.y - aladinRect.top <= offsetHeight / 2.0) {
topDir -= 1;
} else {
topDir += 1;
}*/
}
for (let grandChild of child.children) {