【问题标题】:The Event pressmove of CreateJS doesn't work on desktop browsers (windows touchscreen)CreateJS 的 Event pressmove 在桌面浏览器(windows 触摸屏)上不起作用
【发布时间】:2021-12-24 15:55:24
【问题描述】:

我有这段代码使用事件 mousedown 、 pressmove 和 pressup ,它在 Android、IOS 和 windows (mouseEnent) 上运行良好,但在 windows touchscreeen 上使用手指触摸我收到 mousedown 和 pressup 但事件 pressmove 没有触发。

container.addEventListener("pressup", onpressup);
container.addEventListener("pressmove", onpressmove);
container.addEventListener("mousedown", onmousedown);

mousedown 事件后我没有更改目标。 Createjs v 1.0.0

【问题讨论】:

    标签: jquery-animate createjs touchscreen


    【解决方案1】:

    触摸交互使用不同的鼠标事件。 Touch 类将为您转换事件,并且应该也适用于多点触控设备。

    https://createjs.com/docs/easeljs/classes/Touch.html

    let stage = new createjs.Stage("canvasId");
    createjs.Touch.enable(stage);
    

    【讨论】:

    • 很高兴得到您的回复,我在代码中有这样的语句:stage.enableMouseOver(20); createjs.Touch.enable(stage, false, true); stage.preventSelection = false;在 Android 上,windows+mouse 代码运行良好,但在 windows+finger touch 的特定情况下,如果我点击我的容器,我会得到事件 mousedown 和 mouseup(当我放手指时我没有收到 mousedown在屏幕上,但在我将手指从表面抬起之后)。当我移动时:手指向下+移动+手指向上,我没有得到任何事件。此代码运行良好。:canvas.addEventListener("touchmove", handle).
    • 我注意到语句:createjs.Touch.enable(stage, true, false);即使它在带有可拆卸屏幕的笔记本电脑 windows 10 上运行,也返回 false。 Touch 在同一台笔记本电脑上的其他应用程序运行良好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多