Unselect Scale

PennController for IBEX Forums Requests Unselect Scale

This topic contains 2 replies, has 2 voices, and was last updated by Avatar leaena 3 weeks, 5 days ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4115
    Avatar
    leaena
    Participant

    Just making a note here, in case this is a thing you can or plan to get around to… there is no way to unselect elements of a scale at the moment and it would be useful to have. Working on implementing a workaround, but let me know if this changes at all.

    Thank you!
    Leo

    #4116
    Jeremy
    Jeremy
    Keymaster

    Thanks for posting a request here Leo,

    As a workaround, you can add this at the top of your script to add the command unselect (will only work with getScalenot with newScale):

    var oldGetScale = getScale;
    getScale = name => {
        let t = oldGetScale(name);
        t.unselect = ()=>{
            let e = t._element;
            t._promises.push(()=>new Promise(resolve=>{
                if (e.scaleType == "buttons")
                  e.table.find("td.PennController-"+e.type+"-scaleButton").css("outline","");
                else if (e.scaleType == "slider"){
                  let r = e.table.find("input[type=range]")[0];
                  r.value = (r.max - r.min) / 2;
                }
                else
                  e.table.find(".PennController-"+e.type+"-scaleButton input[type=radio]").removeAttr("checked");
                resolve();
            }));
            return t;
        };
        return t;
    }; 

    Jeremy

    #4117
    Avatar
    leaena
    Participant

    Hooray, you’re the best! Thank you Jeremy! This makes my life much easier.

    Best,
    Leo

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.