Browse Source

Stop svg dragging when mouse is released outside the window. (#189)

Sanjay Ghemawat 7 years ago
parent
commit
bfbedfac5c
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      internal/driver/webhtml.go

+ 6
- 0
internal/driver/webhtml.go View File

@@ -257,6 +257,12 @@ function initPanAndZoom(svg, clickHandler) {
257 257
   }
258 258
 
259 259
   function handleScanMove(e) {
260
+    if (e.buttons == 0) {
261
+      // Missed an end event, perhaps because mouse moved outside window.
262
+      setMode(IDLE)
263
+      svg.removeEventListener("mousemove", handleScanMove)
264
+      return
265
+    }
260 266
     if (mode == MOUSEPAN) panMove(e.clientX, e.clientY)
261 267
   }
262 268