disable changing cuts the first 100ms after the right click to prevent changing cuts when opening the context menu

This commit is contained in:
bmatthieu3
2025-03-14 15:45:16 +01:00
committed by Matthieu Baumann
parent 6d458ccab7
commit 5604ea2be6
3 changed files with 8 additions and 3 deletions

View File

@@ -8,7 +8,7 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', { fov:0.15, target: 'Arp 240', showReticle: false, fullScreen: true });
aladin = A.aladin('#aladin-lite-div', { fov:0.15, target: 'Arp 240', showContextMenu: true, showReticle: false, fullScreen: true });
aladin.setBaseImageLayer(aladin.newImageSurvey('P/SDSS9/g', {colormap: "eosb", stretch: "linear"}));
var simbad = A.catalog({name: 'Simbad', sourceSize: 16, color: '#4050F0'});

View File

@@ -88,4 +88,4 @@ codegen-units = 16
rpath = false
[package.metadata.wasm-pack.profile.release]
wasm-opt = true
wasm-opt = false

View File

@@ -779,7 +779,7 @@ export let View = (function () {
if (view.rightClick) {
const rightClickDurationMs = Date.now() - view.rightClickTimeStart;
if (rightClickDurationMs < 300) {
if (rightClickDurationMs < 100) {
view.aladin.contextMenu && view.aladin.contextMenu.show({e});
}
@@ -959,6 +959,11 @@ export let View = (function () {
return;
}
const rightClickDurationMs = Date.now() - view.rightClickTimeStart;
if (rightClickDurationMs < 100) {
return;
}
if(view.selectedLayer) {
let selectedLayer = view.imageLayers.get(view.selectedLayer);