Mouse issues when changing index.html

Get help using Construct 2

Post » Thu Dec 20, 2012 8:01 pm

I'm not sure if I'm doing something incorrectly, or if this is a bug. I'm guessing the former, so I'm checking here first. When I export a project to an HTML5 website, and change the index.html file in a way that moves the location of the canvas, the mouse doesn't seem to function correctly. Here's an example. The red box is supposed to always be centered on the Mouse. Both links are pulling from the same runtime file:

Standard index.html

index.html with a couple page breaks, and a border around the canvas

In case it helps, I'm exporting using r112, and testing in Firefox. Here's the capx.

Anyone know what I'm doing wrong, or is this a bug?

B
44
S
13
G
7
Posts: 338
Reputation: 10,389

Post » Thu Dec 20, 2012 9:27 pm

The border seems to shift the canvas down and to the right. (Like you'd expect but I don't know why it affects the mouse position) What about adding the border to the div around the canvas instead of the canvas directly. That works and gives the same effect.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Fri Dec 21, 2012 4:37 am

Adding the border to the div around the canvas gives me this.

Granted, my css/html knowledge is very limited, so I could be adding it to the div incorrectly.
B
44
S
13
G
7
Posts: 338
Reputation: 10,389

Post » Fri Dec 21, 2012 4:54 am

In your last link, try to provide more space to "c2canvasdiv".
A width of 660 and removing the <br/> in between the two closing </div> should help.
Modifying only the width value in FF worked for me, the square was already well positioned under the mouse, it was only an aesthetic matter of correctly "framing" the div.


You already did most the work, you might still want to check this tutorial to learn more about editing the index.html file.Kyatric2012-12-21 04:56:32
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805

Post » Fri Dec 21, 2012 11:51 am

Sorry I meant adding it to the existing div (id="c2canvasdiv") not creating another div inside.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Fri Dec 21, 2012 1:55 pm

You should simply style c2canvasdiv - don't add any divs inside it, or style the canvas directly.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Fri Dec 21, 2012 3:34 pm

Perfect. Thanks everyone!
B
44
S
13
G
7
Posts: 338
Reputation: 10,389


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 22 guests