Prechádzať zdrojové kódy

Merge pull request #353 from molstar/drag-tweak

emit drag event whenever started within viewport
David Sehnal 3 rokov pred
rodič
commit
31fd1c9c68

+ 1 - 0
CHANGELOG.md

@@ -13,6 +13,7 @@ Note that since we don't clearly distinguish between a public and private interf
 - Add missing "entity-id" and "enity-source" options for carbon coloring to "element-symbol" color theme
 - Fix VolumeServer/query CLI
 - Support automatic iso-value adjustment for VolumeServer data in ``Viewer.loadVolumeFromUrl``
+- Emit drag event whenever started within viewport (not only for non-empty loci)
 
 ## [v3.0.0] - 2022-01-23
 

+ 1 - 1
src/mol-canvas3d/helper/interaction-events.ts

@@ -71,7 +71,7 @@ export class Canvas3dInteractionHelper {
         const xyChanged = this.startX !== this.endX || this.startY !== this.endY;
 
         if (e === InputEvent.Drag) {
-            if (xyChanged && !Representation.Loci.isEmpty(this.prevLoci)) {
+            if (xyChanged && !this.outsideViewport(this.startX, this.startY)) {
                 this.events.drag.next({ current: this.prevLoci, buttons: this.buttons, button: this.button, modifiers: this.modifiers, pageStart: Vec2.create(this.startX, this.startY), pageEnd: Vec2.create(this.endX, this.endY) });
 
                 this.startX = this.endX;