EaselJS 拖放 - 在响应式发布中使用拖放

EaselJS Drag Drop - With Drag Drop within Responsive Publish

软件: Adob​​e Animate
类型: HTML5 Canvas
发布设置: JavaScript/HTML(循环时间轴|包括隐藏层|中心舞台:两者|做出响应:两者|缩放到可见区域:适合视图)

我创建了一个圆圈并将其转换为影片剪辑。 在第一个框架中,我添加了以下操作:

// Defines "circle" as the object named "circle" in the library.
var circle = this.addChild(new lib.circle());

circle.on("pressmove", function(evt) {
    evt.target.x = evt.stageX;
    evt.target.y = evt.stageY;
});
circle.on("pressup", function(evt) {
    console.log("up");
});

导出为响应式时出现问题,似乎是拖放的偏移。有谁知道这背后的原因和解决方法吗?

我相信这是因为 Animate 的响应式导出扩展了舞台。您可能需要转换坐标。

Check out this answer to an earlier post.

这适用于具有响应缩放功能的 Adob​​e Animate CC。只需将您的 MC 替换为您的影片剪辑即可。

this.yourMC.on("pressmove", function (evt) {
    var p = stage.globalToLocal(evt.stageX, evt.stageY);
    evt.currentTarget.x = p.x;
    evt.currentTarget.y = p.y;
});