Easeljs可滚动容器 [英] Easeljs Scrollable Container

查看:96
本文介绍了Easeljs可滚动容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Easeljs容器,其中包含比屏幕高度高的按钮行.是否可以通过触摸使容器垂直滚动(平移)?想象一下,容器将是设备的宽度,大约是80%的高度.它将从顶部下降10%,在底部10%是不应滚动的导航按钮.我想我可以使用DOMElement,但其余的应用程序仅使用createjs容器构建.该应用程序将通过Cordova推送到Android和IOS设备. 有什么想法吗?

I have an Easeljs container that contains rows of buttons which is taller than the height of the screen. Is it possible to have the container scroll (pan) vertically using touch? Imagine that the container will be the width of the device and approx .80% height. It will be 10% down from the top, and in the bottom 10% will be navigation buttons that should not be scrolled. I guess I could use the DOMElement but the rest of the app has been built using createjs containers only. The app will be pushed out through Cordova to Android and IOS devices. Any ideas please?

推荐答案

以下是可拖动"画布的超快速度示例,应该会给您一些想法.该代码有点旧,因此与最新的EaselJS版本可能有点过时,但是方法是相同的.

Here is a super quick sample of a "draggable" canvas, that should give you some ideas. The code is a little old, so it might be slightly out of date with the latest EaselJS version, but the approach is the same.

http://jsfiddle.net/lannymcnie/jKuyy/

示例代码:

dragBox.addEventListener("mousedown", startDrag); // Object listens to mouse press
function startDrag(event) {
    // Get offset (not shown here, see fiddle)
    event.addEventListener("mousemove", doDrag);
}
function doDrag(event) {
    // Reposition content using event.stageX and event.stageY (the new mouse coordinates)
}

这是原始的SO帖子: 使用EaselJS的无限画布

Here is the original SO post: Infinite canvas with EaselJS

这篇关于Easeljs可滚动容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆