0
私のクリックイベントは、どのバージョンでも動作していないため、実際には解決策が見つかりません。pixijs mousedownイベントが動作しない(すべてのバージョン)
好奇心をそそる問題は、私がmousemoveとmousemoveを入れ替えると、イベントがpixijs canvasに正しく入ることを意味しますが、私のプロジェクトではmousemoveはオプションではありません。
ここに関連するコードです:
// This function gets called from somewhere else
var new_word = getRandomWord();
var color = new_word == currentWord ? 0xffffff : 0xffffff;
var fontSize = isSmallScreen ? Math.round(Math.random() * 10 + 10) : Math.round(Math.random() * 40 + 20);
var creationPadding = isSmallScreen ? 0 : 200;
var text = new PIXI.Text(new_word, {
font: fontSize + 'px Clarendon',
fill: color,
dropShadow: !isTouchDevice,
dropShadowColor: 0xffffff,
dropShadowDistance: 0,
dropShadowBlur: 8,
dropShadowAlpha: .2,
padding: 5,
align: 'left'
});
text.pivot.set(text.width/2, text.height/2);
text.position.x = getRandomArbitrary(creationPadding, renderer.width - creationPadding);
text.position.y = getRandomArbitrary(0, renderer.height - beer.position.y - 156);
text.rotation = degToRad(getRandomArbitrary(-20, 20));
text.interactive = true;
currentlyShownWords.push(text._text);
text.on('mousedown', function (e) {
alert('mousedown');
if (inGame) {
e.stopPropagation();
if (text._text == currentWord) {
clickedCorrectWord(text);
} else {
clickedWrongWord(text);
}
}
});
申し訳ありませんが、これは古い問題であり、私はすでに解決策を見つけたが、私はそれが何だったか覚えていないことができます。答える時間を取って、あなたの答えをアップアップします。 –