Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.postload.js

Issue 5289539543236608: Issue 2100 - Fixed block element dialog moving outside viewport (Closed)
Patch Set: Created March 9, 2015, 2:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -700,8 +700,12 @@
case "clickhide-move":
if (clickHideFiltersDialog)
{
- clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.style.left, 10) + msg.x) + "px";
- clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.style.top, 10) + msg.y) + "px";
+ var rect = clickHideFiltersDialog.getBoundingClientRect();
+ var x = Math.max(0, Math.min(rect.left + msg.x, window.innerWidth - rect.width));
+ var y = Math.max(0, Math.min(rect.top + msg.y, window.innerHeight - rect.height));
+
+ clickHideFiltersDialog.style.left = x + "px";
+ clickHideFiltersDialog.style.top = y + "px";
}
break;
case "clickhide-close":
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld