[solved] drag fonction bug on mobile

  • Hi !
    On mobile, the layer don't take the touch position in real time , and stop !

    desktop it's works ... any idea ?

    <layer name="test" type="text" html="test-drag" edge="center" align="topleft" bg="true" bgcapture="false" capture="true" handcursor="true" selectable="true"
    height="20" width="100" vcenter="true" zorder="100" parent="blockFp"
    ondown="dragTest(get(name),true);"
    onup="dragTest(get(name),false);"

    />


    <action name="dragTest" scope="local" args="layerhp,boolean">
    if(boolean,
    screentolayer(blockFp,mouse.stagex,mouse.stagey,lx,ly);
    set(layer[get(layerhp)].x,get(lx));
    set(layer[get(layerhp)].y,get(ly));

    delayedcall(testFollow,0.01,
    dragTest(get(layerhp),true);
    );
    ,
    stopdelayedcall(testFollow);
    );
    </action>


    same issue with asyncloop:

    <action name="dragTest" scope="local" args="layerhp">
    showlog();
    asyncloop(global.dragtestlayer,
    screentolayer(blockFp,mouse.stagex,mouse.stagey,lx,ly);
    set(layer[get(layerhp)].x,get(lx));
    set(layer[get(layerhp)].y,get(ly));
    );
    </action>

    on mobile it return the x/y pos of blockFp and stop

    layer blockFp is parent="STAGE" and is outside area

    5 Mal editiert, zuletzt von MrTie (3. April 2018 um 11:22)

  • added in js


    and do this on my drag function :


    because the mouse position only work inside area and not outside area + (layer parent = stage) on mobile :)

    Einmal editiert, zuletzt von MrTie (3. April 2018 um 11:48)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!