moving

parent 29840c73
......@@ -272,6 +272,7 @@ var lines;
var maxScroll;
var viewAll;
var dragging;
var moving;
var trialComponents;
function trialRoutineBegin(snapshot) {
return function () {
......@@ -291,6 +292,7 @@ function trialRoutineBegin(snapshot) {
maxScroll -= (round((1.6 / fontSize)) - 1);
viewAll = 0;
dragging = 0;
moving = 0;
scrollText.setPos([((- 0.45) * screenRatio), 0.45]);
scrollText.setAlignHoriz('left');
......@@ -344,48 +346,31 @@ function trialRoutineEachFrame(snapshot) {
if (((viewAll === 1) && _pj.in_es6("space", keys))) {
continueRoutine = false;
} else {
if ((_pj.in_es6("down", keys) && (scroll < maxScroll))) {
if (_pj.in_es6("down", keys)) {
scroll += 1;
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 1;
} else {
if ((_pj.in_es6("up", keys) && (scroll > 0))) {
if (_pj.in_es6("up", keys)) {
scroll -= 1;
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 1;
}
}
}
} else {
if (mouse.isPressedIn(scrollBar)) {
mouseY = mouse.getPos()[1];
if ((mouseY > (trackLength / 2))) {
mouseY = (trackLength / 2);
} else {
if ((mouseY < ((- trackLength) / 2))) {
mouseY = ((- trackLength) / 2);
}
}
scrollButton.setPos([(screenRatio * 0.475), mouseY]);
scroll = ((((trackLength / 2) - mouseY) * maxScroll) / trackLength);
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 1;
} else {
if ((mouse.getPressed()[0] === 1)) {
if ((dragging === 0)) {
dragging = 1;
mouseY = mouse.getPos()[1];
} else {
scroll += (((mouse.getPos()[1] - mouseY) / fontSize) / 1.08);
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
scroll += (((mouse.getPos()[1] - mouseY) * fontSize) * 1.08);
if ((scroll > maxScroll)) {
moving = 1;
}
}
} else {
if ((dragging === 1)) {
......@@ -394,9 +379,19 @@ function trialRoutineEachFrame(snapshot) {
}
}
}
if (((scroll === maxScroll) && (viewAll === 0))) {
viewAll = 1;
continueText.text = "Press space to continue";
if ((moving === 1)) {
if ((scroll >= maxScroll)) {
scroll = maxScroll;
if ((viewAll === 0)) {
viewAll = 1;
continueText.text = "Press space to continue";
}
}
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 0;
}
......
......@@ -282,6 +282,7 @@ var lines;
var maxScroll;
var viewAll;
var dragging;
var moving;
var trialComponents;
function trialRoutineBegin(snapshot) {
return function () {
......@@ -301,6 +302,7 @@ function trialRoutineBegin(snapshot) {
maxScroll -= (round((1.6 / fontSize)) - 1);
viewAll = 0;
dragging = 0;
moving = 0;
scrollText.setPos([((- 0.45) * screenRatio), 0.45]);
scrollText.setAlignHoriz('left');
......@@ -353,48 +355,31 @@ function trialRoutineEachFrame(snapshot) {
if (((viewAll === 1) && _pj.in_es6("space", keys))) {
continueRoutine = false;
} else {
if ((_pj.in_es6("down", keys) && (scroll < maxScroll))) {
if (_pj.in_es6("down", keys)) {
scroll += 1;
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 1;
} else {
if ((_pj.in_es6("up", keys) && (scroll > 0))) {
if (_pj.in_es6("up", keys)) {
scroll -= 1;
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 1;
}
}
}
} else {
if (mouse.isPressedIn(scrollBar)) {
mouseY = mouse.getPos()[1];
if ((mouseY > (trackLength / 2))) {
mouseY = (trackLength / 2);
} else {
if ((mouseY < ((- trackLength) / 2))) {
mouseY = ((- trackLength) / 2);
}
}
scrollButton.setPos([(screenRatio * 0.475), mouseY]);
scroll = ((((trackLength / 2) - mouseY) * maxScroll) / trackLength);
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 1;
} else {
if ((mouse.getPressed()[0] === 1)) {
if ((dragging === 0)) {
dragging = 1;
mouseY = mouse.getPos()[1];
} else {
scroll += (((mouse.getPos()[1] - mouseY) / fontSize) / 1.08);
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
scroll += (((mouse.getPos()[1] - mouseY) * fontSize) * 1.08);
if ((scroll > maxScroll)) {
moving = 1;
}
}
} else {
if ((dragging === 1)) {
......@@ -403,9 +388,19 @@ function trialRoutineEachFrame(snapshot) {
}
}
}
if (((scroll === maxScroll) && (viewAll === 0))) {
viewAll = 1;
continueText.text = "Press space to continue";
if ((moving === 1)) {
if ((scroll >= maxScroll)) {
scroll = maxScroll;
if ((viewAll === 0)) {
viewAll = 1;
continueText.text = "Press space to continue";
}
}
scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);
scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);
bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);
continueText.setOpacity((1 - (0.01 * (scroll % 2))));
moving = 0;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment