Sfoglia il codice sorgente

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

Sanjay Ghemawat 7 anni fa
parent
commit
bfbedfac5c
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6
    0
      internal/driver/webhtml.go

+ 6
- 0
internal/driver/webhtml.go Vedi 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