About the ‘how to have a ➕ desktop’

About the ‘how to have a ➕ desktop’

As Lukas said implementing this from a script can be tricky and will result in a long and complex script due to the personalization the launcher has.

However I though a way to implement this with a relatively very short script that has limitations and very specific instructions that you must follow, but If you follow them (and they are not so strange) it should work correctly. It can be also a start point in case someone want to improve it and make it more ‘universal’

The instructions are:

Set the script to run in the position change event of a container.

Place items that will be the ‘prohibited’ zones (in the video the red ones) that need to have those properties:

Properties of the barrier items:

Label set to “barrier” (this can be changed from script if necessary).

Scale set to 1,1 and skew and rotation to 0.

[Note that it is not necessary to have a red background, but it helps visualizing].

Caveats:

If you enable diagonal scrolling it won’t slide when touching a barrier, it will simply stop. Consider not using diagonal scrolling.

If you enter exit edit mode while a barrier is on view it will jump to the previous saved position, or not move at all if there is no saved one. Consider exiting edit mode always in a ‘valid’ position.

If there are a lot of items in the container it may lag.

With seamless mode it won’t necessarily work as expected. Consider duplicating the barriers yourself if necessary.

Improvements that can be made (for scripters)

Save the barrier’s rects instead of calculating them each time.

Slide instead of stopping when diagonal scrolling is on.

Use also the scale of barriers and maybe even rotation and skew.

Make it valid with seamless mode.

]]>

4 Commentsto About the ‘how to have a ➕ desktop’

  1. Anonymous says:

    < ![CDATA[

    var NAME=”barrier”;




    var cont = LL.getEvent().getContainer();


    var script=LL.getCurrentScript();




    //container rect


    var contrect=[cont.getPositionX(),cont.getPositionY(),cont.getPositionX()+cont.getWidth()/cont.getPositionScale(),cont.getPositionY()+cont.getHeight()/cont.getPositionScale()];




    //barriers


    var barriers=[];



    var items=cont.getItems();


    for(var t=0;t


    var item=items.getAt(t);


    if(item.getLabel()==NAME) barriers.push([item.getPositionX(),item.getPositionY(),item.getPositionX()+item.getWidth(),item.getPositionY()+item.getHeight()]);


    }



    //check if collide


    if(collide(contrect,barriers)){


    var prev=script.getTag();


    if(prev!=null){


    prev=prev.split(” “);


    cont.setPosition(prev[0],prev[1],prev[2],false);


    cont.cancelFling();


    }


    }else{


    script.setTag([cont.getPositionX(),cont.getPositionY(),cont.getPositionScale()].join(” “));


    }





    function collide(a,bList){



    for(var t=0;t


    var b=bList[t];


    if( a[0]>=b[2] || a[1]>=b[3] || b[0]>=a[2] || b[1]>=a[3] ) continue;


    return true;


    }


    return false;


    }

    ]]>

  2. Anonymous says:

    < ![CDATA[

    This is the same setup that can be achieved with stop points (altough it looks easier and more clear for the user).



    The behavior I called complex is the following:


    (pages)


    1 2 3


    4 5 6


    7 8 9



    Scrolling from 2 goes:


    – up: 8


    – down 5


    – left 4


    – right 6


    Scrolling from other pages analog.


    (from the center normal scrolling)



    If you pin items as I described you get this behavior with one exception:


    Moving down from 2 will bring you to one of 4,5,6 and you don’t know which one if you don’t know how you got to 2.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Lukas Morawietz I noticed that after posting, it was late.


    Anyway your solution to the complex layout has a problem: when you are on the corners you have both items simultaneously. I mean if you go to the corner 1, you will see items from the page 2 (they are pinned horizontally) and from 4 (they are pinned vertically)


    The solution by script will be to enable/disable the pinning of the items. (And also teleporting to be always on valid pages)

    ]]>

  4. Anonymous says:

    < ![CDATA[

    TrianguloY


    you’re right for the pinning solution you have to pin either ones, but that doesn’t solve the root cause

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *