Domenicobrz / legendary-cursor

Makes your cursor's swings legendary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mobile support

nlaitan opened this issue · comments

Hi! First of all, thanks for this amazing project, is just that I wanted. So elegant and easy to implement.
Could you add support for mobile users? I referr to touchscreen obviusly

I tried to make a listener for touchmove event but only draws the cursor when user give touches and not when it slides

My functions:

document.addEventListener("touchmove", onTouchMove, false);

function onTouchMove(e) {
    posX = e.touches[0].clientX;
    posY = e.touches[0].clientY;
    
    let ux = (posX / innerWidth) * 2 - 1;
    let uy = ((innerHeight - posY) / innerHeight) * 2 - 1;
    let v = vec3(ux * aspectRatio, uy, 0);
    
    currMousePos = v;
    lastTextureDisp = new THREE.Vector2(posX, posY);
    e.preventDefault();
}

Edit: after a review, the touch draws is already on this lib, not with my event listener. And after putting a console log inside touchmove event, doesn't print anything on console

Hello! I just made a new branch called mobile_support
can you test that one and see if it works?

Hi! I tried with the branch mentioned but doesn't works. Still showing the legend diding touches but not on continuous touching