浏览代码

Handle a cancelled drag

Steven Silvester 8 年之前
父节点
当前提交
a9840bc08f
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/notebook/notebook/widget.ts

+ 4 - 1
src/notebook/notebook/widget.ts

@@ -1183,12 +1183,15 @@ class Notebook extends StaticNotebook {
     document.removeEventListener('mousemove', this, true);
     document.removeEventListener('mouseup', this, true);
     this._drag.start(clientX, clientY).then(action => {
+      this._drag = null;
+      if (action === 'none') {
+        return;
+      }
       let activeCell = cells.at(this.activeCellIndex);
       for (let cell of toremove) {
         this.model.cells.remove(cell);
       }
       this.activeCellIndex = indexOf(cells, activeCell);
-      this._drag = null;
     });
 
   }