diff options
[WGL/HW11] Added offscreen drag barriers
1 files changed, 4 insertions, 0 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Homework 11 - The graph/Homework.html | 4 |
diff --git a/Year 2/Computer Graphics with WebGL/Homework 11 - The graph/Homework.html b/Year 2/Computer Graphics with WebGL/Homework 11 - The graph/Homework.html index 501bd7e..240cea0 100644 --- a/Year 2/Computer Graphics with WebGL/Homework 11 - The graph/Homework.html +++ b/Year 2/Computer Graphics with WebGL/Homework 11 - The graph/Homework.html @@ -97,6 +97,8 @@ slleft.onmousemove = function (e) {
if (!inside || clicked != 1) return;
var newCurr = current + initialPosition - e.clientX;
+ if ((newCurr > leftCurrent) && // if we move left
+ (slright.offsetWidth * 0.4 - leftCurrent < 10)) return;
if ((newCurr < leftCurrent) && // if we move right
(slleft.offsetWidth * 0.4 - leftCurrent >= slright.offsetWidth * 0.6 - rightCurrent - 50)) return;
@@ -105,6 +107,8 @@ slright.onmousemove = function (e) {
if (!inside || clicked != 2) return;
var newCurr = current + initialPosition - e.clientX;
+ if ((newCurr < rightCurrent) && // if we move right
+ (slright.offsetWidth * 0.4 + rightCurrent < 10)) return;
if ((newCurr > rightCurrent) && // if we move left
(slleft.offsetWidth * 0.4 - leftCurrent >= slright.offsetWidth * 0.6 - rightCurrent - 50)) return;
|
