Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:16:53+00:00 2026-06-05T04:16:53+00:00

I am working on an HTML5 game using easlejs + phonegap and am running

  • 0

I am working on an HTML5 game using easlejs + phonegap and am running into an issue where the screen flashes everytime you click/touch/mousedown on the canvas.

Below is the very simple code I created to test the issue and see if it was related to easlejs. As you can see from the code it’s nothing to do with easlejs and is just an html5/phonegap issue.

You can see I also tried the no select CSS styles to no luck.

screenshots showing the orange border when holding mouse down on the canvas (1st image) and then releaseing it (2nd image)

<!doctype html>
<html>
<head>
    <title></title>
    <style type="text/css">
        #canvas
        {
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
        }
    </style>
</head>
<body>
    <canvas  id="canvas" width="320" height="480"></canvas>
    <script type="text/javascript">
        var canvas = document.getElementById("canvas");

        canvas.addEventListener("mousedown", function(e)
        {
            var ctx = canvas.getContext("2d");
            var x = Math.random() * 320;
            var y = Math.random() * 480;
            var w = Math.random() * 100;
            var h = Math.random() * 100;

            ctx.fillStyle = "#FF0000";

            ctx.fillRect(x,y,w,h);
        }, false);
    </script>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:16:54+00:00Added an answer on June 5, 2026 at 4:16 am

    Edit: Turned out EaselJS still had the bug where the touch showed a selection. To resolved this I added a CSS property to the canvas after reading this article: https://stackoverflow.com/a/7981302/66044

    The fix was:
    -webkit-tap-highlight-color: transparent;


    Was able to resolve this with the help of this article:
    Prevent page scroll on drag in IOS and Android

    Here’s the working code. The fix is in handling the touchstart/end events to handle the clicks. No longer experience the orange selection stage.

    Tested this in both the 2.2 emulator and my device (Samsung Captivate running Cyanogenmod ICS)

    <!doctype html>
    <html>
    <head>
        <title></title>
    </head>
    <body>
        <canvas  id="canvas" width="320" height="480"></canvas>
        <script type="text/javascript" src="cordova-1.7.0.js"></script>
        <script type="text/javascript">
            var canvas = document.getElementById("canvas");
    
            // FIX: Cancel touch end event and handle click via touchstart
            document.addEventListener("touchend", function(e) { e.preventDefault(); }, false);
            canvas.addEventListener("touchstart", function(e)
            {
                var ctx = canvas.getContext("2d");
                var x = Math.random() * 320;
                var y = Math.random() * 480;
                var w = Math.random() * 100;
                var h = Math.random() * 100;
    
                ctx.fillStyle = "#FF0000";
    
                ctx.fillRect(x,y,w,h);
    
                // FIX: Cancel the event
                e.preventDefault();
            }, false);
        </script>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a HTML5 canvas game using a JavaScript library called Propulsionjs.com. The
I'm currently working on a game with html5/js, using box2dweb for the collision but
So I am working on implementing an html5 based game into an android app
I'm working on a simple JavaScript game using HTML5 canvas. It's a very typical
Working on a small game using an HTML5 canvas, and javascript. And it's working
I'm developping an HTML5 cross-platform game. Now I'm using Phonegap with the Android sdk.
I'm working on a HTML5 game and have what I think is a math
I am working on a HTML5 website, using UTF-8 charset. I tried to use
How do I develop a working example using this plugin: HTML5 JavaScript Pasting Image
I'm using the HTML5 elements and in a project i'm working on and the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.