X/Y coordinates of rectangle are not updated when the canvas is resized

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Othmar on 28th August 2016
Hi Richard

If i redraw a rectangle and set x and y value new the rectangle is not redrawn. i do this also with text and this works well.
Look at my test is at: www.awekas.at/html5/rgraph/gaugetest1.php

If container will be resized i draw the gauge new. Also text and rectangele for text field. only the rectange properties are not changed.

Where is my fault?

Rest Regards
Posted by Richard on 28th August 2016
Hi there,

I don't think this will work (where you update the X/Y coords:

rect[id].x = rectpos_x;
rect[id].y = rectpos_y;

The size and position of the rectangle are held in the .coords member variable, so try this:

rect[id].coords[0][0] = rectpos_x;
rect[id].coords[0][1] = rectpos_y;

Posted by Othmar on 28th August 2016
Hi Richard,

Thank you for your fast reply. Works fine now!


Add a reply

« Back to message list