Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitfb7a7a1a0f66f8c5bccad284d3c142c9b79cfc09 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-01-03 14:28:08 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-01-03 14:28:08 +0200
Files1615a1e3e7a181e4d3726f89f15498ed74d5b82b
uni-projects-fb7a7a1a0f66f8c5bccad284d3c142c9b79cfc09.tar
uni-projects-fb7a7a1a0f66f8c5bccad284d3c142c9b79cfc09.tar.gz
uni-projects-fb7a7a1a0f66f8c5bccad284d3c142c9b79cfc09.zip
Parent8116979415d27ad8f46d96314b26d7e2331d78b4 (diff)
[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.html4
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;