From 3d4c80cc3e8b1c3f673507ef252e872c374ba431 Mon Sep 17 00:00:00 2001 From: Gabor Csizmadia Date: Mon, 28 Oct 2013 20:15:40 +0100 Subject: [PATCH] docs(guide/directive): fix myDraggable for zoomed page If you have zoomed into the page in your browser then the screen coordinate system no longer matches the page coordinate system. To ensure that dragged elements work correctly when zoomed we should use pageX/pageY rather than screenX/screenY. Closes #4687 --- docs/content/guide/directive.ngdoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/content/guide/directive.ngdoc b/docs/content/guide/directive.ngdoc index 03da25d1d601..d45cacd37167 100644 --- a/docs/content/guide/directive.ngdoc +++ b/docs/content/guide/directive.ngdoc @@ -748,15 +748,15 @@ element? element.on('mousedown', function(event) { // Prevent default dragging of selected content event.preventDefault(); - startX = event.screenX - x; - startY = event.screenY - y; + startX = event.pageX - x; + startY = event.pageY - y; $document.on('mousemove', mousemove); $document.on('mouseup', mouseup); }); function mousemove(event) { - y = event.screenY - startY; - x = event.screenX - startX; + y = event.pageY - startY; + x = event.pageX - startX; element.css({ top: y + 'px', left: x + 'px'