How disabled highlight after clic

0 favourites
  • 8 posts
From the Asset Store
Quickly disable all TNT barrels or everyone will be in danger!
  • Hello,

    After many searches, I can't find the solution.

    When I'm on my mobile, if I click for a long time, the HTML5 game will be selected.

    I can't disable the selection when I click, is there a specific html code to add to prevent this selection?

    Thanks in advance !

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Construct should block that internally. What kind of mobile device? iPhone or Android? What browser?

    From what I gather from googling there is some css to make something not selectable and/or some JavaScript to stop the default behavior in a touch input handler.

    I ask because I’m interested in the cause and solution myself. I haven’t had a chance to do any tests yet though. Overall I think that sounds like a bug or at least something that should be fixed. Have you tried filing an issue? It sounds easy to reproduce.

  • Hmmm, well this can be solved by the user-select css property according to my research. There are two variations of that to work with safari and internet explorer. I can't seem to find where this is used in C2 but I haven't looked too hard in C3. Could this be something that was overlooked? It probably should be reported.

    Anyways running this script at the start of the layout should fix it I think.

    c3canvas.style.webkitUserSelect=c3canvas.style.msUserSelect=c3canvas.style.userSelect="none";

    Edit:

    It's not an issue on pc best I can tell. I was able to test this on safari on ios and this does keep the canvas from being selected.

  • Hello,

    Thank you for your answers,

    I tried the code, unfortunately it did not work on my game.

    And when importing, using the "Advanced Minification" function, the code was broken.

    However I found the solution,

    I added the code below to avoid the selection of the canva (I based on your logic).

    canvas {
     -webkit-touch-callout: none;
     -webkit-user-select: none;
     -khtml-user-select: none;
     -moz-user-select: none;
     -ms-user-select: none;
     user-select: none;
     outline: none;
     -webkit-tap-highlight-color: rgba(255, 255, 255, 0); /* mobile webkit */
     } 
     body {
     -webkit-touch-callout: none;
     -webkit-user-select: none;
     -khtml-user-select: none;
     -moz-user-select: none;
     -ms-user-select: none;
     user-select: none;
     outline: none;
     -webkit-tap-highlight-color: rgba(255, 255, 255, 0); /* mobile webkit */
     }
    

    body is added to avoid the selection around the game if it is not in full screen.

    Have a nice evening !

  • Cool, glad you got it working. I think you could possibly just use the body and the canvas will inherit the same stuff. Anyways I think that touch- callout may have been key.

  • You solved my problem as well. The only thing that confused me was where to put this. Thanks to both of you for figuring it out!

    I realised I had to make a 'Stylesheet' file and add your code to it.

    Hello,

    Thank you for your answers,

    I tried the code, unfortunately it did not work on my game.

    And when importing, using the "Advanced Minification" function, the code was broken.

    However I found the solution,

    I added the code below to avoid the selection of the canva (I based on your logic).

    > canvas {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0); /* mobile webkit */
    } 
    body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0); /* mobile webkit */
    }
    

    body is added to avoid the selection around the game if it is not in full screen.

    Have a nice evening !

  • I realised I had to make a 'Stylesheet' file

    Why not add the code to the game's existing style.css file?

  • Ashley Hi, Construct3 team!

    This problem is still relevant on iOS highlights the screen, have to change the styles file all the time after export.

    Please fix the style file.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)