openDashboard: Get the current location of a stimulus before the trial ends

22 views
Skip to first unread message

Mayan Navon

unread,
Dec 23, 2019, 6:09:04 AM12/23/19
to Minno.js
Hi everyone!

I am currently building a mouse-tracking task.
I want to verify that the participants start to move the mouse when the target stimuli appear. That is, I want to make sure that the participant didn't take a lot of time to move the mouse from the starting location toward the target stimuli.
The solution I had in mind is to compare the x,y location of the mouse at log 1 (or 2..), and compare it to the x.y location of the starting location. The starting location is constant throughout the task (a small button they need to press in order to view the target stimuli).
Is there any way to access the tracking data before the trial ends (with the 'stopMouseTracking' and 'log' actions)?
Do you have a better solution in mind?

Here is the link to the study, and to the mouse tracking task.

Thanks!
Mayan

Yoav Bar-Anan

unread,
Dec 23, 2019, 8:20:17 AM12/23/19
to Minno.js, Elad Zlotnick (pi)
Hi Mayan, 

I haven't tried it, but perhaps the following would work. 
When the participant clicks the button: 
(1) Set an input that will ask them to move with a timeout:
{type:'setInput',input:{handle:'moveWarning',on:'timeout',duration:400}}
(2) Also add an input that will catch if the participant moves away from the button stimulus:
{type:'setInput',input:{handle:'leftStartButton',on:'mouseLeave', stimHandle:'startButton'}}
If 'moveWarning' is triggered, show a warning informing the participant that they must move the mouse more quickly, and you can also change the score or a different variable in the trial's data to indicate in the logging that the participant did not move the mouse quickly enough in this trial. 

If 'leftStartButton' is triggered, use the 'removeInput' action to remove the 'moveWarning':
{type:'removeInput',handle : 'moveWarning'}  

@Elad Zlotnick (pi) might have an alternative elegant solution. 

Yoav

--
You received this message because you are subscribed to the Google Groups "Minno.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minnojs+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/minnojs/c3b985b7-097b-4b54-a578-12b71c95da87%40googlegroups.com.

Mayan Navon

unread,
Dec 24, 2019, 10:30:19 AM12/24/19
to Minno.js
Thanks Yoav!

I tried your solution. I can't get the mouseleave (not mouseLeave, according to the docs) to work. The warning message stays when I move my cursor away from the startButton, and the leaveStartButton event does not appear in the console.
Maybe I misused some property?
Here is my code:

            {
                conditions: [{type:'inputEquals',value:'startButton'}], 
                actions: [
                    {type:'removeInput',handle:['startButton']},
                    {type:'hideStim',handle:'startHandle'}, 
                    {type:'startMouseTracking', logAs:'tracking', logRate: 15, logStimulusLocation: ['startHandle']},            
                    {type:'showStim',handle:'myDomHandle'}, 
                    {type:'showStim',handle:'myNonDomHandle'},                
                    {type:'setInput',input: {handle:'dom',on:'click',stimHandle: 'myDomHandle'}},
                    {type:'setInput',input: {handle:'nonDom',on:'click',stimHandle: 'myNonDomHandle'}},    
                    {type:'setInput',input:{handle:'moveWarning',on:'timeout',duration:400}}, // trigger warning if the participant doesn't move after 400 ms
                    {type:'setInput',input:{handle:'leaveStartButton',on:'mouseleave', stimHandle:'startButton'}}, // catch if the participant moves away from the button stimulus
                    {type:'resetTimer'} 
                ]
            }, 
            {
                conditions: [{type:'inputEqualsTrial', property:'correctResp'}], //Correct
                actions: [
                    {type:'removeInput',handle:['All']},
                    {type:'stopMouseTracking'},
                    {type:'log'},
                    {type:'trigger',handle:'endTrial', duration:350}
                ]
            }, 
            {
                conditions: [{type:'inputEqualsTrial', property:'mistakeResp'}], //Incorrect
                actions: [
                    {type:'removeInput',handle:['All']},
                    {type:'stopMouseTracking'},
                    {type:'setTrialAttr',setter:{score:1}},
                    {type:'log'},
                    {type:'trigger',handle:'endTrial', duration:500}
                ]
            }, 
            {
                conditions: [{type:'inputEquals', value:'moveWarning'}], //no movement
                actions: [
                    {type:'showStim',handle:'moveWarningHandle'}, // show warning
                    {type:'setTrialAttr',setter:{score:2}},
                    {type:'log'}
                ]
            },     
            {
                conditions: [{type:'inputEquals', value:'leaveStartButton'}], // movement happened
                actions: [
                    {type:'removeInput',handle : 'moveWarning'},
                    {type:'hideStim',handle : 'moveWarningHandle'}
                ]
            },

Mayan Navon

unread,
Dec 24, 2019, 11:38:12 AM12/24/19
to Minno.js
I've tried to figure out if mouseleave works.
I used this code to simply present the start button, end then show a feedback sentence once the mouseleave is triggered (see 'moveWarning' conditions in the previous post). 
The feedback is not presented when I use mouseleave or mouseenter, but it is presented when I use mouseup or mousedown. According to the docs, they all take the same properties.
So I guess this means  mouseleave & mouseenter are not working?


            { // begin trial
                conditions: [{type:'begin'}],
                actions: [
                    {type:'showStim',handle:'startHandle'},
                     {type:'setInput',input: {handle:'moveWarning',on:'mouseenter', stimHandle:'startHandle'}}//,mouseup
//                    {type:'setInput',input: {handle:'dom',on:'mouseleave', stimHandle:'startHandle'}},
                ]
            },

Elad Zlotnick

unread,
Dec 25, 2019, 3:40:58 AM12/25/19
to Minno.js
Hi Mayan,

Checking the static location of the mouse is not possible in Javascript, it can only be checked when the mouse is moved.
There are ways to figure out where elements are situated but then you would have to calculate whether the mouse has moved out of the element.
The correct solution I think, is what Yoav suggested.
There was a bug in minno AND a problem with the documentation.
You should simply use mouseout instead of mouseleave and all should be fine https://minnojs.github.io/minno-time/0.5/time/API.html#input

best,
Elad

mouseleave (and mouseenter) are bugged.

Mayan Navon

unread,
Dec 25, 2019, 7:22:37 AM12/25/19
to Minno.js
Thanks! This worked great!
Reply all
Reply to author
Forward
0 new messages