Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
CreateJS click target is wrong on Samsung Internet browser

I develop a html5 canvas browser game with createjs (Adobe Animate) and after the last update of Samsung Internet browser when the user clicks somewhere, it fires the click event for totally different button. It looks like the createjs native method _getObjectsUnderPoint() gives the wrong target of the click. Even when I click on empty space on the stage, where there is not buttons, a click handler is fired. This strange behavior is not present in Google Chrome or Opera for mobile, only in Samsung Internet.
In rare cases, even though the click target is correct, the handler is not called. More specifically, the problem must be in the createjs functions _testMask() or _testHit(). They use the canvas context and matrix transformations.
Does anyone has idea what should be fixed in the CreateJs library for Samsung Internet browser.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I solved the problem like this:

  1. Check if the user agent contains SamsungBrowser

    var userAgent = navigator.userAgent;
    userAgent = userAgent.toLowerCase();
    var isSamsungBrowser = userAgent.indexOf("samsungbrowser") != -1;
    
  2. In CreateJs in _getObjectsUnderPoint() I added this near the end of the for loop:

    if(isSamsungBrowser) {
        var bounds = child.getBounds();
        if(bounds) {
            var p = child.globalToLocal(x, y);
            var hit = p.x >= bounds.x &&
                p.x <= bounds.x + bounds.width &&
                p.y >= bounds.y &&
                p.y <= bounds.y + bounds.height;
            if(! hit) {
                continue;
            }
        }
        else {
            console.error('NO BOUNDS FOR', child);
            continue;
        }
    }
    
  3. The only drawback is that every Shape must have bounds. So you can convert the shapes to bitmaps in Adobe Animate or use setBounds().

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda