1.drawing the original canvas on to the new temporary canvas
2.resize the original canvas (which will clear it) - make sure to use setCoordinateSpaceWidth so that the actual pixel size remains consistent with the new canvas size.
3.draw the temporary canvas onto the original canvas in the correct position
Regarding resizing on canvas and panels in general: the best way is to make sure that the entire chain of panels from the root layout panel all implement, and create a FocusWidget that implements RequiresResize, and override this method in the widget:
public void onResize() {
int width = this.getElement().getParentElement().getClientWidth();
int height = this.getElement().getParentElement().getClientHeight();
if (this.getCoordinateSpaceWidth() != width)
this.setCoordinateSpaceWidth(width);
if (this.getCoordinateSpaceHeight() != height)
this.setCoordinateSpaceHeight(height);
}
On Monday, December 17, 2012 9:32:25 PM UTC+2, membersound wrote:
I have a gwt canvas which should take the whole space of the main centered contend in a docklayout.--
<g:DockLayoutPanel unit='PCT'>
//...
<g:center>
<g:Label>
<c:Canvas...>
</g:Label>
</g:center>
Now, If I resize the browser window, I do NOT want the painted graphics to be resized. Only the "outer" canvas drawing area should be resized along with the browser so that the canvas is still visible. But some of the already drawings may be cutted.
(Similar to google maps, where the map stays the same all the time nomatter how the browser window changes size).
How could I do this?
Thanks
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/3EKxrlyFCEAJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment