diff --git a/examples/al-init-custom-options.html b/examples/al-init-custom-options.html index 5b580961..7ccbf283 100644 --- a/examples/al-init-custom-options.html +++ b/examples/al-init-custom-options.html @@ -1,7 +1,6 @@ - diff --git a/src/css/aladin.css b/src/css/aladin.css index e32030b9..e12c7e46 100644 --- a/src/css/aladin.css +++ b/src/css/aladin.css @@ -204,7 +204,7 @@ border-radius: 2px; position: absolute; max-width: 15em; - font-size: 0.8rem; + font-size: inherit; font-family: monospace; background: #fff; @@ -694,7 +694,6 @@ canvas { margin: 0; padding: 0; - box-shadow: 0 0 8px rgba(0,0,0,0.2); /*font-family: Verdana, Geneva, Tahoma, sans-serif;*/ border-radius: 3px; @@ -784,16 +783,17 @@ canvas { right: 0; } -.aladin-context-menu .aladin-context-sub-menu.top { - top: 100%; - transform: translateY(-100%); -} - .aladin-context-menu .aladin-context-sub-menu.bottom { top: 100%; left: 0; } +.aladin-context-menu .aladin-context-sub-menu.top { + top: 0; + left: 0; + transform: translateY(-100%); +} + .aladin-context-menu .aladin-context-sub-menu.left.top { transform: translate(-100%, -100%); } @@ -845,7 +845,7 @@ canvas { outline: 0; /*font: inherit;*/ /* Personalize */ - padding: 2px; + padding: 0.2em; font-size: inherit; border-radius: 0.25em; box-shadow: 0 0 1em 0 rgba(0, 0, 0, 0.2); diff --git a/src/js/DefaultActionsForContextMenu.js b/src/js/DefaultActionsForContextMenu.js index 3151d21b..028c188b 100644 --- a/src/js/DefaultActionsForContextMenu.js +++ b/src/js/DefaultActionsForContextMenu.js @@ -34,6 +34,7 @@ import { CatalogQueryBox } from "./gui/Box/CatalogQueryBox.js"; import cameraIconUrl from '../../assets/icons/camera.svg' import targetIconUrl from '../../assets/icons/target.svg'; import uploadIconUrl from '../../assets/icons/upload.svg'; +import selectIconUrl from '../../assets/icons/select.svg'; export let DefaultActionsForContextMenu = (function () { @@ -164,7 +165,11 @@ export let DefaultActionsForContextMenu = (function () { files.forEach(file => { const url = URL.createObjectURL(file); +<<<<<<< HEAD let moc = A.MOCFromURL(url, { name: file.name, edge: true }); +======= + let moc = A.MOCFromURL(url, { name: file.name, opacity: 0.4 }); +>>>>>>> cfa6574e (fix context sub menu deploy for small screen) a.addMOC(moc); }); }; @@ -190,6 +195,30 @@ export let DefaultActionsForContextMenu = (function () { } ] }, + { + label: { + icon: { + monochrome: true, + url: selectIconUrl, + size: 'small', + }, + content: "Select sources" + }, + subMenu: [ + { + label: 'Circular', + action(o) { + a.select('circle', selectObjects) + } + }, + { + label: 'Rectangular', + action(o) { + a.select('rect', selectObjects) + } + } + ] + }, { label: { icon: { @@ -219,23 +248,6 @@ export let DefaultActionsForContextMenu = (function () { window.open(hips2fitsUrl, '_blank'); } }, - { - label: "Select sources", - subMenu: [ - { - label: 'Circular', - action(o) { - a.select('circle', selectObjects) - } - }, - { - label: 'Rectangular', - action(o) { - a.select('rect', selectObjects) - } - } - ] - }, ] } diff --git a/src/js/gui/Widgets/ContextMenu.js b/src/js/gui/Widgets/ContextMenu.js index 34acea71..2b41eab1 100644 --- a/src/js/gui/Widgets/ContextMenu.js +++ b/src/js/gui/Widgets/ContextMenu.js @@ -329,19 +329,15 @@ export class ContextMenu extends DOMElement { child.classList.remove('left', 'right', 'top', 'bottom'); - // first check if there is place towards the right, which is the desired behaviour - console.log( parent, o) + // First check if there is place towards the right, which is the desired behaviour if (aladinRect.right - (o.x + o.width) >= c.width) { - // do nothing - console.log("right") - // a good second option would be to plot it on the bottom + // do nothing as it is by default considering this case + } else if (o.x - aladinRect.left >= c.width) { + child.classList.add('left'); } else if (aladinRect.bottom - (o.y + o.height) >= c.height) { child.classList.add('bottom'); - - console.log("bottom") - } else { - console.log("else") + child.classList.add('top'); } /*if (r.y - aladinRect.top <= offsetHeight / 2.0) { @@ -378,8 +374,9 @@ export class ContextMenu extends DOMElement { let mouseCoords = options && options.e && Utils.relMouseCoords(options.e) // Set position const position = - options && options.position || - {left: mouseCoords.x, top: mouseCoords.y}; + options && options.position || + {left: mouseCoords.x, top: mouseCoords.y}; + this.setPosition({...position, aladin: this.aladin}) for (let childEl of this.el.children) {