Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!