【发布时间】:2015-07-28 16:13:22
【问题描述】:
我注意到在 pixi.js 版本 1.3 中,如本例所示,堆叠精灵,然后单击并拖动只会拖动最顶部的精灵。
bunny.mousedown = bunny.touchstart = function(data)
{
// data.originalEvent.preventDefault()
// store a refference to the data
// The reason for this is because of multitouch
// we want to track the movement of this particular touch
this.data = data;
this.alpha = 0.9;
this.dragging = true;
this.sx = this.data.getLocalPosition(bunny).x * bunny.scale.x;
this.sy = this.data.getLocalPosition(bunny).y * bunny.scale.y;
};
http://jsfiddle.net/dirkk0/cXfpq/
在 3.0.3 版本中,如本例所示,相同的代码导致鼠标下的所有精灵都被拖动。
http://jsfiddle.net/9tnaa31z/5/
有没有办法只获取最顶部的精灵或获取所有精灵的列表(按渲染顺序)?
【问题讨论】:
-
为什么要更改我的标签? pixi 是 webgl 和 canvas 的东西,而不仅仅是 javascript
标签: javascript sprite pixi.js