mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2026-06-12 11:01:37 -07:00
fix some bgs before beta
This commit is contained in:
committed by
Matthieu Baumann
parent
796603596d
commit
45129708db
@@ -5,13 +5,14 @@
|
||||
<body>
|
||||
|
||||
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>
|
||||
<div id="toolbar"></div>
|
||||
|
||||
<script type="module">
|
||||
import showUrl from './../assets/icons/show.svg';
|
||||
import A from '../src/js/A.js';
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin('#aladin-lite-div', {samp: true, survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:2.0, target: "22 35 58.39 +33 57 57.8", showSettingsControl: true, log: false});
|
||||
aladin = A.aladin('#aladin-lite-div', {toolbar: {divSelector: '#toolbar', vertical: false}, samp: true, survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:2.0, target: "22 35 58.39 +33 57 57.8", showSettingsControl: true, log: false});
|
||||
aladin.setProjection('AIT');
|
||||
let cfht = aladin.createImageSurvey("CFHT", "CFHT MegaCam u+g+r", "./data/hips/CFHT", "equatorial", 10, {imgFormat: 'png'});
|
||||
let jwst1 = aladin.createImageSurvey("CDS/P/JWST/Stephans-Quintet/NIRCam+MIRI", "JWST NIRCam+MIRI", "data/hips/JWST_NIRCam_MIRI", null, null, {imgFormat: 'png'});
|
||||
|
||||
+4756
-4756
File diff suppressed because it is too large
Load Diff
+9
-9
@@ -16,7 +16,6 @@
|
||||
|
||||
/* Aladin lite default color */
|
||||
--aladin-color: #b232b2;
|
||||
--aladin-color-border: #fff;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
@@ -507,21 +506,21 @@
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.aladin-container .small-sized-icon {
|
||||
.aladin-small-sized-icon {
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
}
|
||||
|
||||
.aladin-container .medium-sized-icon {
|
||||
.aladin-medium-sized-icon {
|
||||
width: 1.6rem;
|
||||
height: 1.6rem;
|
||||
}
|
||||
|
||||
.aladin-container .medium-sized {
|
||||
.aladin-medium-sized {
|
||||
height: 1.6rem;
|
||||
}
|
||||
|
||||
.aladin-container .small-sized {
|
||||
.aladin-small-sized {
|
||||
height: 1.2rem;
|
||||
}
|
||||
|
||||
@@ -1106,22 +1105,22 @@ otherwise it fits its content options. If those are too big the select can go ou
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
|
||||
.aladin-container .aladin-color-picker {
|
||||
.aladin-color-picker {
|
||||
transform: translate(10px, 10px);
|
||||
position: fixed;
|
||||
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.aladin-container .aladin-view-label {
|
||||
.aladin-view-label {
|
||||
font-weight: bold;
|
||||
font-family: monospace;
|
||||
background-color: #00000000;
|
||||
font-size: 1rem;
|
||||
color: var(--aladin-color);
|
||||
|
||||
text-shadow: 1px 0 var(--aladin-color-border), -1px 0 var(--aladin-color-border), 0 1px var(--aladin-color-border), 0 -1px var(--aladin-color-border),
|
||||
1px 1px var(--aladin-color-border), -1px -1px var(--aladin-color-border), 1px -1px var(--aladin-color-border), -1px 1px var(--aladin-color-border);
|
||||
text-shadow: 1px 0 var(--border-color), -1px 0 var(--border-color), 0 1px var(--border-color), 0 -1px var(--border-color),
|
||||
1px 1px var(--border-color), -1px -1px var(--border-color), 1px -1px var(--border-color), -1px 1px var(--border-color);
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
@@ -1304,6 +1303,7 @@ otherwise it fits its content options. If those are too big the select can go ou
|
||||
|
||||
.aladin-widgets-toolbar > * {
|
||||
padding-top: 0rem;
|
||||
margin-right: 0rem;
|
||||
}
|
||||
|
||||
.aladin-fullScreen-control {
|
||||
|
||||
+4
-3
@@ -117,8 +117,6 @@ A.aladin = function (divSelector, options) {
|
||||
} else {
|
||||
theme = retrieveDefaultMode()
|
||||
}
|
||||
// Retrieve the data-theme from localStorage or system preferences
|
||||
divElement.setAttribute("data-theme", theme);
|
||||
|
||||
// Associate the CSS inside the div
|
||||
var cssStyleSheet = document.createElement('style')
|
||||
@@ -126,7 +124,10 @@ A.aladin = function (divSelector, options) {
|
||||
cssStyleSheet.innerHTML = aladinCSS;
|
||||
divElement.appendChild(cssStyleSheet)
|
||||
|
||||
return new Aladin(divElement, options);
|
||||
let aladin = new Aladin(divElement, options);
|
||||
aladin._applyTheme(theme)
|
||||
|
||||
return aladin;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+25
-8
@@ -42,7 +42,6 @@ import { Coo } from "./libs/astro/coo.js";
|
||||
import { CooConversion } from "./CooConversion.js";
|
||||
import { HiPSCache } from "./HiPSCache.js";
|
||||
import { HiPSList } from "./DefaultHiPSList.js";
|
||||
import stackOverlayIconUrl from './../../assets/icons/stack.svg';
|
||||
import { Toolbar } from "./gui/Toolbar.js";
|
||||
import { ProjectionEnum } from "./ProjectionEnum.js";
|
||||
|
||||
@@ -70,13 +69,11 @@ import { Stack } from "./gui/Button/Stack.js";
|
||||
import { SettingsButton } from "./gui/Button/Settings";
|
||||
import { SimbadPointer } from "./gui/Button/SimbadPointer";
|
||||
import { ColorPicker } from "./gui/Button/ColorPicker";
|
||||
import { OverlayStackBox } from "./gui/Box/StackBox.js";
|
||||
import { GridEnabler } from "./gui/Button/GridEnabler";
|
||||
import { CooFrame } from "./gui/Input/CooFrame";
|
||||
import { Circle } from "./shapes/Circle";
|
||||
import { Ellipse } from "./shapes/Ellipse";
|
||||
import { Polyline } from "./shapes/Polyline";
|
||||
import { WidgetTogglerButton } from "./gui/Button/Toggler.js";
|
||||
|
||||
/**
|
||||
* @typedef {Object} AladinOptions
|
||||
@@ -337,6 +334,10 @@ export let Aladin = (function () {
|
||||
...Aladin.DEFAULT_OPTIONS.gridOptions,
|
||||
...requestedOptions.gridOptions
|
||||
},
|
||||
toolbar: {
|
||||
...Aladin.DEFAULT_OPTIONS.toolbar,
|
||||
...requestedOptions.toolbar
|
||||
},
|
||||
// and use the slice method to create a new array for the hipsList property:
|
||||
// https://stackoverflow.com/questions/7486085/copy-array-by-value
|
||||
hipsList: requestedOptions.hipsList || Aladin.DEFAULT_OPTIONS.hipsList.slice()
|
||||
@@ -561,11 +562,25 @@ export let Aladin = (function () {
|
||||
}
|
||||
};
|
||||
|
||||
Aladin.prototype._applyTheme = function(newTheme) {
|
||||
this.aladinDiv.setAttribute("data-theme", newTheme);
|
||||
this.toolbar.el.setAttribute("data-theme", newTheme);
|
||||
}
|
||||
|
||||
Aladin.prototype._setupUI = function (options) {
|
||||
let self = this;
|
||||
|
||||
this.contextMenu = new ContextMenu(this);
|
||||
|
||||
let toolbarDivSelector = options && options.toolbar.divSelector || this.aladinDiv;
|
||||
if (!(toolbarDivSelector instanceof HTMLElement)) {
|
||||
toolbarDivSelector = document.querySelector(toolbarDivSelector);
|
||||
}
|
||||
this.toolbar = new Toolbar([], {
|
||||
classList: ["aladin-widgets-toolbar"],
|
||||
vertical: options && options.toolbar.vertical
|
||||
}, toolbarDivSelector)
|
||||
|
||||
// Status bar
|
||||
if (options.showStatusBar) {
|
||||
this.statusBar = new StatusBarBox(this);
|
||||
@@ -628,11 +643,9 @@ export let Aladin = (function () {
|
||||
widgets["share"] = share;
|
||||
}
|
||||
|
||||
let toolbar = new Toolbar(widgets, {
|
||||
classList: ["aladin-widgets-toolbar"]
|
||||
})
|
||||
this.toolbar = toolbar;
|
||||
this.addUI(toolbar)
|
||||
for (let [name, widget] of Object.entries(widgets)) {
|
||||
this.toolbar.add(name, widget);
|
||||
}
|
||||
|
||||
if (options.showProjectionControl) {
|
||||
this.projBtn = new ProjectionActionButton(this);
|
||||
@@ -759,6 +772,10 @@ export let Aladin = (function () {
|
||||
realFullscreen: false,
|
||||
pixelateCanvas: true,
|
||||
manualSelection: false,
|
||||
toolbar: {
|
||||
vertical: true,
|
||||
divSelector: null,
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ import HomeIconUrl from '../../assets/icons/maximize.svg';
|
||||
import SpectraIconUrl from '../../assets/icons/freq.svg';
|
||||
import { Utils } from "./Utils";
|
||||
import { Aladin } from "./Aladin";
|
||||
|
||||
import { DOMElement } from "./gui/Widgets/Widget";
|
||||
/******************************************************************************
|
||||
* Aladin Lite project
|
||||
*
|
||||
@@ -34,7 +34,7 @@ import { Aladin } from "./Aladin";
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
export class SpectraDisplayer {
|
||||
export class SpectraDisplayer extends DOMElement {
|
||||
static UNIT = {
|
||||
FREQUENCY: {
|
||||
label: "f",
|
||||
@@ -118,6 +118,8 @@ export class SpectraDisplayer {
|
||||
};
|
||||
|
||||
constructor(view, options) {
|
||||
super()
|
||||
|
||||
let createPlotCanvas = (name) => {
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.classList.add(name);
|
||||
@@ -615,7 +617,7 @@ export class SpectraDisplayer {
|
||||
);*/
|
||||
}
|
||||
|
||||
hide() {
|
||||
_hide() {
|
||||
if (this.isHidden) {
|
||||
return;
|
||||
}
|
||||
@@ -624,7 +626,7 @@ export class SpectraDisplayer {
|
||||
this.isHidden = true;
|
||||
}
|
||||
|
||||
show() {
|
||||
_show() {
|
||||
if (!this.isHidden) {
|
||||
return;
|
||||
}
|
||||
@@ -654,7 +656,7 @@ export class SpectraDisplayer {
|
||||
window.addEventListener("spectra", this.spectraUpdateCallback);
|
||||
|
||||
this.resetScale();
|
||||
this.show()
|
||||
this._show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -597,7 +597,7 @@ export let View = (function () {
|
||||
}
|
||||
|
||||
if (this.spectraDisplayer)
|
||||
this.spectraDisplayer.hide();
|
||||
this.spectraDisplayer._hide();
|
||||
|
||||
if (imageLayer.dataproductType === "spectral-cube") {
|
||||
if (!this.spectraDisplayer) {
|
||||
|
||||
@@ -328,7 +328,7 @@ import { WidgetTogglerButton } from "../Button/Toggler.js";
|
||||
},
|
||||
tooltip: {content: 'Show/hide spectra', position: {direction: 'bottom'}},
|
||||
toggled: true,
|
||||
enabled(o) {
|
||||
enable: (o) => {
|
||||
spectraDisplayer.attachHiPS3D(options.layer)
|
||||
},
|
||||
widget: {
|
||||
|
||||
@@ -995,7 +995,7 @@ export class OverlayStackBox extends Box {
|
||||
|
||||
let spectraDisplayer = aladin.view.spectraDisplayer;
|
||||
if (hips instanceof HiPS && spectraDisplayer && hips === spectraDisplayer.hips) {
|
||||
spectraDisplayer.hide()
|
||||
spectraDisplayer._hide()
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -197,6 +197,7 @@ import { ShareActionButton } from "./ShareView.js";
|
||||
label: {
|
||||
content: [backgroundColorInput, 'Back color']
|
||||
},
|
||||
mustHide: false,
|
||||
},
|
||||
{
|
||||
label: {
|
||||
@@ -206,7 +207,7 @@ import { ShareActionButton } from "./ShareView.js";
|
||||
action(o) {
|
||||
const currentTheme = aladin.aladinDiv.getAttribute("data-theme");
|
||||
const newTheme = currentTheme === "dark" ? "light" : "dark";
|
||||
aladin.aladinDiv.setAttribute("data-theme", newTheme);
|
||||
aladin._applyTheme(newTheme);
|
||||
localStorage.setItem("theme", newTheme);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -42,6 +42,6 @@ export class SnapshotActionButton extends ActionButton {
|
||||
}
|
||||
})
|
||||
|
||||
this.addClass('medium-sized-icon')
|
||||
this.addClass('aladin-medium-sized-icon')
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// Copyright 2013 - UDS/CNRS
|
||||
// The Aladin Lite program is distributed under the terms
|
||||
// of the GNU General Public License version 3.
|
||||
//
|
||||
// This file is part of Aladin Lite.
|
||||
//
|
||||
// Aladin Lite is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 3 of the License.
|
||||
//
|
||||
// Aladin Lite is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// The GNU General Public License is available in COPYING file
|
||||
// along with Aladin Lite.
|
||||
//
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Aladin Lite project
|
||||
*
|
||||
* File gui/Stack/Menu.js
|
||||
*
|
||||
*
|
||||
* Author: Matthieu Baumann [CDS, matthieu.baumann@astro.unistra.fr]
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
import { ActionButton } from "../Widgets/ActionButton.js";
|
||||
|
||||
/*
|
||||
options = {
|
||||
action: (connector) => {
|
||||
|
||||
}
|
||||
tooltip
|
||||
}
|
||||
*/
|
||||
export class WidgetOpenerActionButton extends ActionButton {
|
||||
// Constructor
|
||||
constructor(options) {
|
||||
let widget = options.widget;
|
||||
super({
|
||||
...options,
|
||||
action(e) {
|
||||
if (widget.isHidden) {
|
||||
widget._show();
|
||||
} else {
|
||||
widget._hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.addClass('medium-sized-icon')
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@
|
||||
...options
|
||||
})
|
||||
|
||||
this.addClass('medium-sized');
|
||||
this.addClass('aladin-medium-sized');
|
||||
|
||||
self = this;
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ export class Location extends DOMElement {
|
||||
value: parseCoo(),
|
||||
});
|
||||
|
||||
field.addClass("medium-sized")
|
||||
field.addClass("aladin-medium-sized")
|
||||
|
||||
let copyBtn = new ActionButton({
|
||||
icon: {
|
||||
|
||||
@@ -43,10 +43,7 @@ export class Toolbar extends Layout {
|
||||
constructor(widgets, options, target, position = "beforeend") {
|
||||
super(
|
||||
[],
|
||||
{
|
||||
vertical: true,
|
||||
...options
|
||||
},
|
||||
options,
|
||||
target,
|
||||
position
|
||||
)
|
||||
|
||||
@@ -107,9 +107,9 @@ export class ActionButton extends DOMElement {
|
||||
}
|
||||
|
||||
if (this.options.size === 'small') {
|
||||
this.addClass('small-sized-icon')
|
||||
this.addClass('aladin-small-sized-icon')
|
||||
} else if (this.options.size === 'medium') {
|
||||
this.addClass('medium-sized-icon')
|
||||
this.addClass('aladin-medium-sized-icon')
|
||||
}
|
||||
|
||||
if (this.options.action) {
|
||||
|
||||
@@ -90,9 +90,9 @@ export class Icon extends DOMElement {
|
||||
this.el.innerHTML = '';
|
||||
|
||||
if (this.options.size === 'small') {
|
||||
this.addClass('small-sized-icon')
|
||||
this.addClass('aladin-small-sized-icon')
|
||||
} else if (this.options.size === 'medium') {
|
||||
this.addClass('medium-sized-icon')
|
||||
this.addClass('aladin-medium-sized-icon')
|
||||
}
|
||||
|
||||
if (this.options.title) {
|
||||
|
||||
Reference in New Issue
Block a user