Reply To: hide cursor and select by pointing

PennController for IBEX Forums Support hide cursor and select by pointing Reply To: hide cursor and select by pointing

#6517
Jeremy
Keymaster

Hey Peiyao,

There are a few things going on here, but the simplest solution is just to revert back to 1.8. Just type 1.8 in the branch field when syncing, following the instructions here

One problem with 1.9 is that I seem to have broken how selector.shuffle keeps track of the elements indices. Otherwise, I would have suggested this code (which should behave as expected in the next release of PennController):

newTrial(
    newButton("Start")
        .print("center at 50vw", "middle at 50vh")
        .wait()
        .remove()
    ,
    newCanvas("container",600,600).print("center at 50vw","middle at 50vh")
    ,
    newCanvas('red', 200,200).color('red').print(0, 0, getCanvas("container")),
    newCanvas('green', 200,200).color('green').print("right at 100%",0,getCanvas("container")),
    newCanvas('pink', 200,200).color('pink').print(0,"bottom at 100%",getCanvas("container")),
    newCanvas('blue', 200,200).color('blue').print("right at 100%","bottom at 100%",getCanvas("container"))
    ,
    newFunction( ()=>{
        $("body").css({
            width: '100vw',
            height: '100vh',
            cursor: 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="), auto'
        });
        setTimeout(()=>$("body").bind('mousemove', ()=>{
            $('body').css('cursor','unset');
            $('.PennController-container .PennController-Canvas').bind('mouseenter', e=>getSelector("response")
                .select(getCanvas(e.target.className.replace(/.*(blue|red|pink|green).*/,"$1")))._runPromises()
            );
        }), 100);
    }).call()
    ,
    newSelector("response")
        .add( getCanvas("red"),getCanvas("green"),getCanvas("pink"),getCanvas("blue") )
        .shuffle()
        .log()
        .wait()
)

Right now the only problem with this code is that you lose track of where each element is effectively displayed to your participant (you’ll see an order reported in the results file, but it’s just incorrect). If you don’t care about that piece of information, then definitely stay with 1.9 and use this code

Jeremy