extra comments

parent 30e33b20
......@@ -310,11 +310,8 @@ function trialRoutineBegin(snapshot) {
moving = 0;
scrollText.setPos([((- 0.45) * screenRatio), 0.45]);
maxScroll +=round(.6/fontSize);
maxScroll -=73;
//.04 => 39 but needs to be 20
//.03 => 52
//.02 => 79 but needs to be 99
maxScroll += round(.6/fontSize);
maxScroll -= 73;
scrollText.setAlignHoriz('left');
scrollText.setAlignVert('top');
// keep track of which components have finished
......
......@@ -320,11 +320,8 @@ function trialRoutineBegin(snapshot) {
moving = 0;
scrollText.setPos([((- 0.45) * screenRatio), 0.45]);
maxScroll +=round(.6/fontSize);
maxScroll -=73;
//.04 => 39 but needs to be 20
//.03 => 52
//.02 => 79 but needs to be 99
maxScroll += round(.6/fontSize);
maxScroll -= 73;
scrollText.setAlignHoriz('left');
scrollText.setAlignVert('top');
// keep track of which components have finished
......
......@@ -103,7 +103,7 @@
<Param name="Begin Experiment" updates="constant" val="screenRatio = win.size[0]/win.size[1]&amp;#10;&amp;#10;if float(expInfo['fontSize'])&gt;0:&amp;#10; fontSize = float(expInfo['fontSize'])&amp;#10;else:&amp;#10; fontSize=.03&amp;#10;mouseY=0&amp;#10;trackLength=.9&amp;#10;trackWidth=.04" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="screenRatio = (win.size[0] / win.size[1]);&amp;#10;if ((Number.parseFloat(expInfo[&quot;fontSize&quot;]) &gt; 0)) {&amp;#10; fontSize = Number.parseFloat(expInfo[&quot;fontSize&quot;]);&amp;#10;} else {&amp;#10; fontSize = 0.03;&amp;#10;}&amp;#10;mouseY = 0;&amp;#10;trackLength = 0.9;&amp;#10;trackWidth = 0.04;&amp;#10;" valType="extendedCode"/>
<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;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;# If you can't see all your text, &amp;#10;# replace the following line with &amp;#10;# maxScroll = x where x is the number&amp;#10;# of missing lines.&amp;#10;maxScroll = 0&amp;#10;for line in lines:&amp;#10; maxScroll += math.ceil(len(line)*fontSize/screenRatio)&amp;#10;&amp;#10;viewAll=0&amp;#10;dragging=0&amp;#10;moving=0" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="scroll = 0&amp;#10;lines = scrollText.text.split('\n')&amp;#10;# If you can't see all your text, &amp;#10;# replace the following line with &amp;#10;# maxScroll = x where x is the number&amp;#10;# of missing lines, or negative numbers&amp;#10;# to remove blank lines.&amp;#10;maxScroll = 0&amp;#10;for line in lines:&amp;#10; maxScroll += math.ceil(len(line)*fontSize/screenRatio)&amp;#10;&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; mouseY=mouse.getPos()[1]&amp;#10; moving=1&amp;#10;elif dragging==1:&amp;#10; dragging=0&amp;#10;if moving==1:&amp;#10; if scroll &lt;0:&amp;#10; scroll=0&amp;#10; elif 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; text_2.text = str(scroll)+' of '+str(maxScroll)&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; mouseY = mouse.getPos()[1];&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 &lt; 0)) {&amp;#10; scroll = 0;&amp;#10; } else {&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; }&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; text_2.text = ((scroll.toString() + &quot; of &quot;) + maxScroll.toString());&amp;#10; moving = 0;&amp;#10;}&amp;#10;" valType="extendedCode"/>
......@@ -143,8 +143,8 @@
<Param name="Before JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin Experiment" updates="constant" val="import math" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="maxScroll +=round(.6/fontSize);&amp;#10;maxScroll -=73;&amp;#10;//.04 =&gt; 39 but needs to be 20&amp;#10;//.03 =&gt; 52&amp;#10;//.02 =&gt; 79 but needs to be 99&amp;#10;scrollText.setAlignHoriz('left');&amp;#10;scrollText.setAlignVert('top');" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="maxScroll-=round(1.5/fontSize)-1&amp;#10;scrollText.anchorHoriz='left'&amp;#10;scrollText.anchorVert='top'&amp;#10;scrollText.alignText='left'" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="maxScroll += round(.6/fontSize);&amp;#10;maxScroll -= 73;&amp;#10;scrollText.setAlignHoriz('left');&amp;#10;scrollText.setAlignVert('top');" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="maxScroll += round(.5/fontSize)&amp;#10;maxScroll -= -73&amp;#10;scrollText.anchorHoriz='left'&amp;#10;scrollText.anchorVert='top'&amp;#10;scrollText.alignText='left'" valType="extendedCode"/>
<Param name="Code Type" updates="None" val="Both" valType="str"/>
<Param name="Each Frame" updates="constant" val="" valType="extendedCode"/>
<Param name="Each JS Frame" 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