Greetings
I am trying to get a DOMRect from an Element. I can do this with JSNI, but
have been unable to make a JsInterop version. Here's what I have:
public final class DOMRect extends JavaScriptObject
{
// returns DOMRect or null
public static native DOMRect getBoundingClientRect(Element element)
/*-{
return element.getBoundingClientRect && element.getBoundingClientRect();
}-*/;
protected DOMRect()
{
}
public final native double getX()
/*-{
return this.x;
}-*/;
// etc.
}
I can make a JsType for DOMRect, no problem. The issue I'm having is with
getBoundingClientRect(). This function may not exist which is why there is
a null check. If I make an interface for getBoundingClientRect, I'm not
allowed to cast Element to implement it. I can't extend Element, either.
With JSNI, I am allowed to compile Javascript into Javascript, but I can't
with JsInterop. It seems like a lot of trouble for 1 line of Javascript.
How can I do this? Thanks in advance...
--
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.