scroll+=(mouse.getPos()[1]-mouseY)/fontSize*1.08

parent 59afd76d
......@@ -367,7 +367,7 @@ function trialRoutineEachFrame(snapshot) {
dragging = 1;
mouseY = mouse.getPos()[1];
} else {
scroll += (((mouse.getPos()[1] - mouseY) * fontSize) * 1.08);
scroll += (((mouse.getPos()[1] - mouseY) / fontSize) * 1.08);
moving = 1;
}
} else {
......
......@@ -376,7 +376,7 @@ function trialRoutineEachFrame(snapshot) {
dragging = 1;
mouseY = mouse.getPos()[1];
} else {
scroll += (((mouse.getPos()[1] - mouseY) * fontSize) * 1.08);
scroll += (((mouse.getPos()[1] - mouseY) / fontSize) * 1.08);
moving = 1;
}
} else {
......
......@@ -79,8 +79,8 @@
<Param name="Begin JS Routine" updates="constant" val="scroll = 0;&amp;#10;lines = scrollText.text.split(&quot;\n&quot;);&amp;#10;maxScroll = 0;&amp;#10;for (var line, _pj_c = 0, _pj_a = lines, _pj_b = _pj_a.length; (_pj_c &lt; _pj_b); _pj_c += 1) {&amp;#10; line = _pj_a[_pj_c];&amp;#10; maxScroll += Math.ceil(((line.length * fontSize) / screenRatio));&amp;#10;}&amp;#10;maxScroll -= (round((1.6 / fontSize)) - 1);&amp;#10;viewAll = 0;&amp;#10;dragging = 0;&amp;#10;moving = 0;&amp;#10;" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="scroll = 0&amp;#10;lines = scrollText.text.split('\n')&amp;#10;maxScroll = 0&amp;#10;for line in lines:&amp;#10; maxScroll += math.ceil(len(line)*fontSize/screenRatio)&amp;#10;&amp;#10;maxScroll-=round(1.6/fontSize)-1&amp;#10;viewAll=0&amp;#10;dragging=0&amp;#10;moving=0" valType="extendedCode"/>
<Param name="Code Type" updates="None" val="Auto-&gt;JS" valType="str"/>
<Param name="Each Frame" updates="constant" val="keys=event.getKeys()&amp;#10;if len(keys):&amp;#10; if viewAll==1 and 'space' in keys:&amp;#10; continueRoutine=False&amp;#10; elif 'down' in keys:&amp;#10; scroll+=1&amp;#10; moving=1&amp;#10; elif 'up' in keys:&amp;#10; scroll-=1&amp;#10; moving=1&amp;#10;elif mouse.isPressedIn(scrollBar):&amp;#10; mouseY=mouse.getPos()[1]&amp;#10; scroll = (trackLength/2-mouseY)*maxScroll/trackLength&amp;#10; moving=1&amp;#10;elif (mouse.getPressed()[0] == 1):&amp;#10; if dragging==0:&amp;#10; dragging=1&amp;#10; mouseY=mouse.getPos()[1]&amp;#10; else:&amp;#10; scroll+=(mouse.getPos()[1]-mouseY)*fontSize*1.08&amp;#10; moving=1&amp;#10;elif dragging==1:&amp;#10; dragging=0&amp;#10;if moving==1:&amp;#10; if scroll&gt;=maxScroll:&amp;#10; scroll=maxScroll&amp;#10; if viewAll == 0:&amp;#10; viewAll=1&amp;#10; continueText.text='Press space to continue' &amp;#10; scrollText.setPos((-.45*screenRatio, .45+scroll*fontSize*1.08))&amp;#10; scrollButton.setPos((screenRatio*.475, trackLength/2-trackLength*scroll/maxScroll))&amp;#10; bottomCrop.setPos((-.1+.01*(scroll%2), -.475))&amp;#10; continueText.setOpacity(1-.01*(scroll%2))&amp;#10; moving=0" valType="extendedCode"/>
<Param name="Each JS Frame" updates="constant" val="var _pj;&amp;#10;function _pj_snippets(container) {&amp;#10; function in_es6(left, right) {&amp;#10; if (((right instanceof Array) || ((typeof right) === &quot;string&quot;))) {&amp;#10; return (right.indexOf(left) &gt; (- 1));&amp;#10; } else {&amp;#10; if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {&amp;#10; return right.has(left);&amp;#10; } else {&amp;#10; return (left in right);&amp;#10; }&amp;#10; }&amp;#10; }&amp;#10; container[&quot;in_es6&quot;] = in_es6;&amp;#10; return container;&amp;#10;}&amp;#10;_pj = {};&amp;#10;_pj_snippets(_pj);&amp;#10;keys = event.getKeys();&amp;#10;if (keys.length) {&amp;#10; if (((viewAll === 1) &amp;&amp; _pj.in_es6(&quot;space&quot;, keys))) {&amp;#10; continueRoutine = false;&amp;#10; } else {&amp;#10; if (_pj.in_es6(&quot;down&quot;, keys)) {&amp;#10; scroll += 1;&amp;#10; moving = 1;&amp;#10; } else {&amp;#10; if (_pj.in_es6(&quot;up&quot;, keys)) {&amp;#10; scroll -= 1;&amp;#10; moving = 1;&amp;#10; }&amp;#10; }&amp;#10; }&amp;#10;} else {&amp;#10; if (mouse.isPressedIn(scrollBar)) {&amp;#10; mouseY = mouse.getPos()[1];&amp;#10; scroll = ((((trackLength / 2) - mouseY) * maxScroll) / trackLength);&amp;#10; moving = 1;&amp;#10; } else {&amp;#10; if ((mouse.getPressed()[0] === 1)) {&amp;#10; if ((dragging === 0)) {&amp;#10; dragging = 1;&amp;#10; mouseY = mouse.getPos()[1];&amp;#10; } else {&amp;#10; scroll += (((mouse.getPos()[1] - mouseY) * fontSize) * 1.08);&amp;#10; moving = 1;&amp;#10; }&amp;#10; } else {&amp;#10; if ((dragging === 1)) {&amp;#10; dragging = 0;&amp;#10; }&amp;#10; }&amp;#10; }&amp;#10;}&amp;#10;if ((moving === 1)) {&amp;#10; if ((scroll &gt;= maxScroll)) {&amp;#10; scroll = maxScroll;&amp;#10; if ((viewAll === 0)) {&amp;#10; viewAll = 1;&amp;#10; continueText.text = &quot;Press space to continue&quot;;&amp;#10; }&amp;#10; }&amp;#10; scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);&amp;#10; scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);&amp;#10; bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);&amp;#10; continueText.setOpacity((1 - (0.01 * (scroll % 2))));&amp;#10; moving = 0;&amp;#10;}&amp;#10;" valType="extendedCode"/>
<Param name="Each Frame" updates="constant" val="keys=event.getKeys()&amp;#10;if len(keys):&amp;#10; if viewAll==1 and 'space' in keys:&amp;#10; continueRoutine=False&amp;#10; elif 'down' in keys:&amp;#10; scroll+=1&amp;#10; moving=1&amp;#10; elif 'up' in keys:&amp;#10; scroll-=1&amp;#10; moving=1&amp;#10;elif mouse.isPressedIn(scrollBar):&amp;#10; mouseY=mouse.getPos()[1]&amp;#10; scroll = (trackLength/2-mouseY)*maxScroll/trackLength&amp;#10; moving=1&amp;#10;elif mouse.getPressed()[0] == 1:&amp;#10; if dragging==0:&amp;#10; dragging=1&amp;#10; mouseY=mouse.getPos()[1]&amp;#10; else:&amp;#10; scroll+=(mouse.getPos()[1]-mouseY)/fontSize*1.08&amp;#10; moving=1&amp;#10;elif dragging==1:&amp;#10; dragging=0&amp;#10;if moving==1:&amp;#10; if scroll&gt;=maxScroll:&amp;#10; scroll=maxScroll&amp;#10; if viewAll == 0:&amp;#10; viewAll=1&amp;#10; continueText.text='Press space to continue' &amp;#10; scrollText.setPos((-.45*screenRatio, .45+scroll*fontSize*1.08))&amp;#10; scrollButton.setPos((screenRatio*.475, trackLength/2-trackLength*scroll/maxScroll))&amp;#10; bottomCrop.setPos((-.1+.01*(scroll%2), -.475))&amp;#10; continueText.setOpacity(1-.01*(scroll%2))&amp;#10; moving=0" valType="extendedCode"/>
<Param name="Each JS Frame" updates="constant" val="var _pj;&amp;#10;function _pj_snippets(container) {&amp;#10; function in_es6(left, right) {&amp;#10; if (((right instanceof Array) || ((typeof right) === &quot;string&quot;))) {&amp;#10; return (right.indexOf(left) &gt; (- 1));&amp;#10; } else {&amp;#10; if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {&amp;#10; return right.has(left);&amp;#10; } else {&amp;#10; return (left in right);&amp;#10; }&amp;#10; }&amp;#10; }&amp;#10; container[&quot;in_es6&quot;] = in_es6;&amp;#10; return container;&amp;#10;}&amp;#10;_pj = {};&amp;#10;_pj_snippets(_pj);&amp;#10;keys = event.getKeys();&amp;#10;if (keys.length) {&amp;#10; if (((viewAll === 1) &amp;&amp; _pj.in_es6(&quot;space&quot;, keys))) {&amp;#10; continueRoutine = false;&amp;#10; } else {&amp;#10; if (_pj.in_es6(&quot;down&quot;, keys)) {&amp;#10; scroll += 1;&amp;#10; moving = 1;&amp;#10; } else {&amp;#10; if (_pj.in_es6(&quot;up&quot;, keys)) {&amp;#10; scroll -= 1;&amp;#10; moving = 1;&amp;#10; }&amp;#10; }&amp;#10; }&amp;#10;} else {&amp;#10; if (mouse.isPressedIn(scrollBar)) {&amp;#10; mouseY = mouse.getPos()[1];&amp;#10; scroll = ((((trackLength / 2) - mouseY) * maxScroll) / trackLength);&amp;#10; moving = 1;&amp;#10; } else {&amp;#10; if ((mouse.getPressed()[0] === 1)) {&amp;#10; if ((dragging === 0)) {&amp;#10; dragging = 1;&amp;#10; mouseY = mouse.getPos()[1];&amp;#10; } else {&amp;#10; scroll += (((mouse.getPos()[1] - mouseY) / fontSize) * 1.08);&amp;#10; moving = 1;&amp;#10; }&amp;#10; } else {&amp;#10; if ((dragging === 1)) {&amp;#10; dragging = 0;&amp;#10; }&amp;#10; }&amp;#10; }&amp;#10;}&amp;#10;if ((moving === 1)) {&amp;#10; if ((scroll &gt;= maxScroll)) {&amp;#10; scroll = maxScroll;&amp;#10; if ((viewAll === 0)) {&amp;#10; viewAll = 1;&amp;#10; continueText.text = &quot;Press space to continue&quot;;&amp;#10; }&amp;#10; }&amp;#10; scrollText.setPos([((- 0.45) * screenRatio), (0.45 + ((scroll * fontSize) * 1.08))]);&amp;#10; scrollButton.setPos([(screenRatio * 0.475), ((trackLength / 2) - ((trackLength * scroll) / maxScroll))]);&amp;#10; bottomCrop.setPos([((- 0.1) + (0.01 * (scroll % 2))), (- 0.475)]);&amp;#10; continueText.setOpacity((1 - (0.01 * (scroll % 2))));&amp;#10; moving = 0;&amp;#10;}&amp;#10;" valType="extendedCode"/>
<Param name="End Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="End JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="End JS Routine" updates="constant" val="" valType="extendedCode"/>
......
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