Unselect Scale

PennController for IBEX Forums Requests Unselect Scale

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

Viewing 4 posts - 1 through 4 (of 4 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

    EDIT: the unselect command was introduced in PennController 1.6.

    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

    • This reply was modified 2 weeks, 2 days ago by Jeremy Jeremy. Reason: Command added to PennController 1.6
    #4117
    Avatar
    leaena
    Participant

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

    Best,
    Leo

    #4648
    Jeremy
    Jeremy
    Keymaster

    I forgot to update this thread sooner, but the unselect command was introduced in PennController 1.6.

    Jeremy

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

You must be logged in to reply to this topic.