Re-sizing Canvas Alignment Issue

0 favourites
  • 9 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • On exported projects, after resizing the canvas, the canvas aligns with the left side of the screen. Resizing the canvas works fine when testing the capx. The problem only occurs for exported projects (I've only tried it when exporting for an HTML5 website).

    Link to .capx file (required!):

    Example

    Capx

    Steps to reproduce:

    1. Create an event that resizes the canvas

    2. Export to HTML5 website

    3. Run the exported index.html

    Observed result:

    The canvas aligns to the left side of the screen.

    Expected result:

    The canvas remains centered

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: yes

    Operating system & service pack:

    Windows 7 64bit

    Windows 8 64bit

    iOS

    Construct 2 version: 126

  • Just wanted to give everyone a heads up that resizing the canvas still causes alignment issues in r129 when exporting to HTML5.

    Also, if this is causing a problem for anyone else, a workaround is to display the canvas in an iframe. This is pretty simple to set up with r128's feature allowing you to export the game to HTML5 using the "embed" style.

  • zatyka Yes, i'm having this issue too, maybe let's give him a time to fix this issue when he gets chance,

  • zatyka Joannesalfa Have you tried in Build 130 yet to see if it was resolved?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • BluePhaze Yes, it's fixed for windowed canvas, not fullscreen

  • Sorry for the delay, I've been away on business. Exporting to an HTML5 website using the Normal style with r131 still causes the misalignment issue.

  • zatyka did you find a solution?

  • ghost

    I didn't find any solution, but I did work around the problem by displaying my canvas in a centered iframe rather than putting the canvas directly on the page. However, that only worked because I needed to change canvas sizes for a single tick to grab a screenshot of a specific size. After I took the screenshot, I would return the canvas size to normal (the size of the iframe). This method would not work well in most cases, especially when changing the canvas size is integral to gameplay.

  • thanks zatyka

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