Create.js拖拽事件处理机制
2017-07-10 14:46
375 查看
直接上代码 ,怕自己忘记
sheetContainer.on("mousedown", function (evt) {
this.parent.addChild(this);
this.offset = {x: this.x - evt.stageX, y: this.y - evt.stageY};
});
sheetContainer.on("pressmove", function (evt) {
this.x = evt.stageX + this.offset.x;
this.y = evt.stageY + this.offset.y;
// indicate that the stage should be updated on the next tick:
update = true;
});
sheetContainer.on("mousedown", function (evt) {
this.parent.addChild(this);
this.offset = {x: this.x - evt.stageX, y: this.y - evt.stageY};
});
sheetContainer.on("pressmove", function (evt) {
this.x = evt.stageX + this.offset.x;
this.y = evt.stageY + this.offset.y;
// indicate that the stage should be updated on the next tick:
update = true;
});
相关文章推荐
- Create.js键盘事件处理机制
- JS:事件鼠标处理机制
- js 绑定事件 处理机制 监听机制
- JS中事件处理机制
- js事件封装函数,js跨浏览器事件处理机制
- js事件处理相关-实现一个div的拖拽
- 浅谈下js事件处理机制
- 【js事件详解】js事件封装函数,js跨浏览器事件处理机制
- Cocos2d-JS事件处理机制
- js监听 冒泡机制 dojo事件处理
- node.js中的事件处理机制及事件环机制
- 【js事件详解】js事件封装函数,js跨浏览器事件处理机制
- 【js事件详解】js事件封装函数,js跨浏览器事件处理机制
- js事件处理机制
- Cocos2d-JS 事件处理机制
- js事件驱动机制 浏览器兼容处理方法
- js事件对象兼容处理及传播机制
- Cocos2d-JS事件处理机制
- Cocos2d-js 事件处理机制
- 《Node.js》之事件处理机制以及事件环机制(二)