Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda