Sfoglia il codice sorgente

Merge branch 'master' of https://github.com/molstar/molstar into pr/giagitom/533

Alexander Rose 2 anni fa
parent
commit
cb0cbd06ce

+ 1 - 0
CHANGELOG.md

@@ -15,6 +15,7 @@ Note that since we don't clearly distinguish between a public and private interf
 - Fix handling of PDB TER records (#549)
 - Add support for getting multiple loci from a representation (``.getAllLoci()``)
 - Add ``key`` property to intra- and inter-bonds for referencing source data
+- Fix click event triggered after move
 
 ## [v3.16.0] - 2022-08-25
 

+ 0 - 4
src/mol-model-formats/structure/pdb/atom-site.ts

@@ -67,21 +67,17 @@ export function getAtomSite(sites: AtomSiteTemplate, terIndices: Set<number>): {
         const seqId = auth_seq_id.int(i);
         let atomId = auth_atom_id.str(i);
 
-        let asymIdChanged = false;
-
         if (modelNum !== currModelNum) {
             asymIdCounts.clear();
             atomIdCounts.clear();
             currModelNum = modelNum;
             currAsymId = asymId;
             currSeqId = seqId;
-            asymIdChanged = true;
             currLabelAsymId = asymId;
         } else if (currAsymId !== asymId) {
             atomIdCounts.clear();
             currAsymId = asymId;
             currSeqId = seqId;
-            asymIdChanged = true;
             currLabelAsymId = asymId;
         } else if (currSeqId !== seqId) {
             atomIdCounts.clear();

+ 7 - 1
src/mol-util/input/input-observer.ts

@@ -304,6 +304,7 @@ namespace InputObserver {
         let buttons = ButtonsType.create(ButtonsType.Flag.None);
         let button = ButtonsType.Flag.None;
         let isInside = false;
+        let hasMoved = false;
 
         const events = createEvents();
         const { drag, interactionEnd, wheel, pinch, gesture, click, move, leave, enter, resize, modifiers, key } = events;
@@ -577,12 +578,13 @@ namespace InputObserver {
             if (!mask(ev.clientX, ev.clientY)) return;
 
             eventOffset(pointerEnd, ev);
-            if (Vec2.distance(pointerEnd, pointerDown) < 4) {
+            if (!hasMoved && Vec2.distance(pointerEnd, pointerDown) < 4) {
                 const { pageX, pageY } = ev;
                 const [x, y] = pointerEnd;
 
                 click.next({ x, y, pageX, pageY, buttons, button, modifiers: getModifierKeys() });
             }
+            hasMoved = false;
         }
 
         function onPointerMove(ev: PointerEvent) {
@@ -604,6 +606,10 @@ namespace InputObserver {
             const isStart = dragging === DraggingState.Started;
             if (isStart && !mask(ev.clientX, ev.clientY)) return;
 
+            if (Vec2.distance(pointerEnd, pointerDown) >= 4) {
+                hasMoved = true;
+            }
+
             const [dx, dy] = pointerDelta;
             drag.next({ x, y, dx, dy, pageX, pageY, buttons, button, modifiers: getModifierKeys(), isStart });