Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MaterialCutOut on MaterialTableWidget not correct #406

Open
SandraK82 opened this issue Apr 17, 2020 · 3 comments
Open

MaterialCutOut on MaterialTableWidget not correct #406

SandraK82 opened this issue Apr 17, 2020 · 3 comments

Comments

@SandraK82
Copy link

SandraK82 commented Apr 17, 2020

I tried to make an CutOut on a Widget inside a Table (inside a Collapsible) and the CutOut did not appear. After Debugging I found that the CutOut had a wrong top value -800 something pixels.
I fixed it by Overriding MaterialCutOut:setupCutOutPosition with an Addition:

private static native int top(Element element) /*-{ 
	return element.getBoundingClientRect().top;
}-*/;

private static native int left(Element element) /*-{ 
	return element.getBoundingClientRect().left;
}-*/;

protected void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle) {
        float top = relativeTo.getOffsetTop() - (Math.max($("html").scrollTop(), $("body").scrollTop()));
        float left = relativeTo.getAbsoluteLeft();

        float width = relativeTo.getOffsetWidth();
        float height = relativeTo.getOffsetHeight();

        if(left < 0 || top < 0) {
        	top = top(relativeTo);
        	left = left(relativeTo);
        }
        if (circle) {
…

Now it works as expected

@kevzlou7979
Copy link
Contributor

kevzlou7979 commented Apr 17, 2020

Cool, can we convert the JSNI code to JSInterop

  private static native int top(Element element) /*-{ 
	return element.getBoundingClientRect().top;
  }-*/;

@SandraK82
Copy link
Author

SandraK82 commented Apr 17, 2020 via email

@kevzlou7979
Copy link
Contributor

I think what we can do is to use elemental2 will take a look on how we can support it as GWT 3 will not support JSNI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants