Jump to content

mousedown in ie11?


jonigiuro
 Share

Recommended Posts

Hi,

my click events aren't working in any version of ie and I can't really find a solution for it.

The curious thing is that if I swap my mousedown with a mousemove it works, meaning the events get into the pixijs canvas correctly, but in my project the mousemove is not an option

Here's the relevant code:

Thank you for every help

var isTouchDevice = $('html').hasClass('touch');

// 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);

        if (isTouchDevice) {
            text.on('touchstart', function (e) {
                alert('touch');
                if (inGame) {
                    e.stopPropagation();
                    if (text._text == currentWord) {
                        clickedCorrectWord(text);
                    } else {
                        clickedWrongWord(text);
                    }
                }
            });
        } else {
            text.on('mousedown', function (e) {
                alert('mousedown');
                if (inGame) {
                    e.stopPropagation();
                    if (text._text == currentWord) {
                        clickedCorrectWord(text);
                    } else {
                        clickedWrongWord(text);
                    }
                }
            });
            text.filters = [displacementFilter]; // filters only on NON touch devices for performance reasons
        }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...