aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/guide/directive.ngdoc
diff options
context:
space:
mode:
authorGabor Csizmadia2013-10-28 20:15:40 +0100
committerPete Bacon Darwin2013-10-28 22:01:15 +0000
commit3d4c80cc3e8b1c3f673507ef252e872c374ba431 (patch)
tree8bb2ab1cc7ab62c079f256a816aac758fba6f0ed /docs/content/guide/directive.ngdoc
parentd3b38dda0644e200310a52b00ae0c3cbbcbf2cc1 (diff)
downloadangular.js-3d4c80cc3e8b1c3f673507ef252e872c374ba431.tar.bz2
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
Diffstat (limited to 'docs/content/guide/directive.ngdoc')
-rw-r--r--docs/content/guide/directive.ngdoc8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/content/guide/directive.ngdoc b/docs/content/guide/directive.ngdoc
index 03da25d1..d45cacd3 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'