event.getTouchX/Y return a constant value in positionchanged event.

event.getTouchX/Y return a constant value in positionchanged event.

]]>

8 Commentsto event.getTouchX/Y return a constant value in positionchanged event.

  1. Anonymous says:

    < ![CDATA[

    Also event.getTouchScreenX/Y return the correct change, but the starting point is wrong.

    ]]>

  2. Anonymous says:

    < ![CDATA[

    To see this put the following script in the tap empty space and positionchanged event of a desktop, enable infinite scrolling.



    If you first tap in the middle and then start to scroll with your finger somewhere else, the values are incorrect (as visualized) they start at the point where you tapped, only the difference is correct…

    ]]>

  3. Anonymous says:

    < ![CDATA[

    var d=LL.getCurrentDesktop();


    var i=d.getItemByLabel(“bg”)


    if(i==null)


    {


    i=d.addShortcut(“bg”,new Intent(),0,0);


    var p=i.getProperties();


    d.setItemZIndex(i.getId(),d.getItems().getLength()-1);


    var editor=p.edit();


    editor.setBoolean(“i.onGrid”,false).setString(“i.pinMode”,”XY”).setBoolean(“i.enabled”,false).setBoolean(“s.iconVisibility”,false).setBoolean(“s.labelVisibility”,false);


    editor.getBox(“i.box”).setColor(“c”,”n”,0x00000000);


    editor.commit();


    i.setSize(d.getWidth(),d.getHeight());


    i.setPosition(0,0);


    }




    var pic=i.getBoxBackground(“n”)||LL.createImage(i.getWidth(),i.getHeight());


    var e=LL.getEvent();


    var canvas=pic.draw();


    var p=new Paint();


    p.setARGB(255,255,255,255);


    p.setStrokeWidth(10);


    var bef=JSON.parse(i.getTag());


    if(bef!=null)


    canvas.drawLine(bef[0],bef[1],e.getTouchScreenX(),e.getTouchScreenY(),p);


    i.setTag(JSON.stringify([e.getTouchScreenX(),e.getTouchScreenY()]));


    pic.update();


    i.setBoxBackground(pic,”n”);



    var sessiontoken;


    do{


    sessiontoken=””+Math.random();


    }while(sessiontoken==d.getTag());


    d.setTag(sessiontoken);


    setTimeout(f,50);



    function f()


    {


    if(d.getTag()==sessiontoken)


    {


    i.setBoxBackground( LL.createImage(i.getWidth(),i.getHeight()),”n”);


    d.setPosition(0,0,1,false);


    i.setTag(null);


    }


    }

    ]]>

  4. Anonymous says:

    < ![CDATA[

    I really hope that Pierre will be available to do this.


    Be able to know the position of the finger will be very useful.



    As a side note I didn’t know that it worked with relative positions. I’ll test your script when possible but: what happen when you release the finger and the container continues scrolling? Just return the last available value?

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Idk. Maybe return null… ATM the position moves further with the desktop, even if there is no finger on the screen anymore. 



    Pierre Hébert I hope you can do sth about it. I have so many ideas what I could do with these values…

    ]]>

  6. Anonymous says:

    < ![CDATA[

    In fact these functions are really not designed for what you are looking for. They provide contextual info (either relative to the container or absolute for the screen) but they are not designed for touch interaction, and this simply cannot work because you need more data to handle this properly.


    However I see what you are trying to do, and I was hoping that someone would try it 😉


    I guess that a new event has to be created. It would transmit full touch events, including up/down/move and multitouch data, but I don’t know yet whether it can works or not.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Let’s hope so 😉

    ]]>

  8. Anonymous says:

    < ![CDATA[

    After some experiments, the event can be sent on any item, but this would have strong implications: firstly it would prevent scrolling (the item catches events, and as a consequence they can’t be used elsewhere, a bit like panels), and secondly it may break other events such as tap, long tap, depending on the script itself.


    But I think this is doable.

    ]]>

Leave a Reply

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