On Tuesday, September 13, 2016 at 3:30:49 PM UTC+2, Kirill Prazdnikov wrote:
>
> Hi, I have the following code:
>
> public static Vec2i elementSizeToDeviceSize(Element element) {
>>   float devicePixelRatio = devicePixelRatio();
>>   ClientRect rect = GwtNativeUtil.getBoundingClientRect(element);
>>   float x0 = (float) (rect.getLeft() * devicePixelRatio);
>>   float x1 = (float) (rect.getRight() * devicePixelRatio);
>>   float y0 = (float) (rect.getTop() * devicePixelRatio);
>>   float y1 = (float) (rect.getBottom() * devicePixelRatio);
>>
>>   return new Vec2i(Math.round(x1 - x0), Math.round(y1 - y0));
>> }
>>
>>
> GwtNativeUtil.getBoundingClientRect is native JSNI function.
>
>
> It returns 
>
>   public interface ClientRect extends JSObject 
>
> which has 
>
>   @JsProperty double getLeft();
>
>
> And the GWT compiler 2.8-rc2 emits the following code:
>
>
> function hEb(a) {
>>     var b, c, d, e, f;
>>     b = gEb();
>>     a.getBoundingClientRect();
>>     c = null.hf() * b;
>>     d = null.hf() * b;
>>     e = null.hf() * b;
>>     f = null.hf() * b;
>>     return new Tvb(Oj($wnd.Math.round(d - c)), Oj($wnd.Math.round(f - e)))
>> }
>>
>>
>
>
> This code is not a valid code. Is this a bug ?  
>
> The compiler did not throw an any message. 
>
>
> I`m using -Dgwt.style=PRETTY
>
>
See https://github.com/gwtproject/gwt/issues/9330
You must be missing an isNative=true on ClientRect 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to