2
如何爲每個Kinetic.Rect創建一個點擊事件?Kinetic.js:每個rect的點擊事件
比方說,我有這樣的:
var bar1 = new Kinetic.Rect({
x: 0,
y: 100,
width: 400,
height: 10,
fill: 'grey',
stroke: 'black',
strokeWidth: 2
});
var bar2 = new Kinetic.Rect({
x: 0,
y: 100,
width: 400,
height: 10,
fill: 'grey',
stroke: 'black',
strokeWidth: 2
});
有沒有辦法有兩個條相同的點擊事件? 可能使用jQuery?
感謝您的評論綁定!我確實需要知道點擊了哪個矩形,我不認爲這是可能的。 – RobinvdA
測試'e.target' – mikakun
e.target是一個HTMLCanvasElement – RobinvdA