nikhilbchilwant / google-web-toolkit-incubator

Automatically exported from code.google.com/p/google-web-toolkit-incubator
1 stars 1 forks source link

GWTCanvas should override setPixelSize(w, h) #276

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of gwt and gwt-incubator are you using?
1.6-compatible

GWTCanvas has two methods -- setPixelWidth() and setPixelHeight()--to change 
the size of the 
canvas.

UIObject, a base class of GWTCanvas, has setPixelSize(w, h), but this is not 
overridden in 
GWTCanvas. As a result, the call provides different results on IE and other 
browsers because the 
IMPL-specific variants are not called by setPixelSize().

What is the expected output? What do you see instead?

IE resizes, but the scale does not change, as it does in Safari and Firefox. I 
would expect 
setPixelSize() to work the same for both.

Workaround if you have one:

Call setPixelWidth(), then setPixelHeight().

Original issue reported on code.google.com by reentry.espresso@gmail.com on 15 May 2009 at 10:12

GoogleCodeExporter commented 8 years ago

Original comment by jaime...@google.com on 5 Aug 2009 at 12:09

GoogleCodeExporter commented 8 years ago
Well the proposed workaround does not seem to work for me at all. (I am 
checking on 
IE 7)
When I set pixel size/width/height, the element doubles in size but the drawing 
does 
not scale (as it does in FF,Safari,Opera). 

Am I missing something?
The code below demonstrates it:

    public void onModuleLoad() {
        final Button button = new Button("Click me to scale!");
        final GWTCanvas canvas = new GWTCanvas(200,200,200,200);
        RootPanel.get().add(canvas);
        RootPanel.get().add(button);
        canvas.setStrokeStyle(Color.BLUE);
        canvas.strokeRect(0, 0, 100, 100);
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                canvas.setPixelWidth(400);
                canvas.setPixelHeight(400);
            }
        });
    }

Original comment by urg...@gmail.com on 24 Oct 2009 at 8:05