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

Changing clip area does not work with renderer: canvas #830

Closed
jessegreenberg opened this issue Jul 11, 2018 · 9 comments
Closed

Changing clip area does not work with renderer: canvas #830

jessegreenberg opened this issue Jul 11, 2018 · 9 comments

Comments

@jessegreenberg
Copy link
Contributor

From in phetsims/resistance-in-a-wire#164. In resistance-in-a-wire, I tried setting WireNode's dotsNode to use renderer: canvas, but I discovered that this broke the clip area that is further down in the file.

dotsNode.clipArea = wireBody.shape.ellipticalArc( -width / 2, 0, PERSPECTIVE_FACTOR * height / 2, height / 2, 0, 3 * Math.PI / 2, Math.PI / 2, true );

@jonathanolson is this indicative of something wrong with clip area, or is setting renderer: canvas the wrong thing to do here?

@jessegreenberg
Copy link
Contributor Author

On the other hand, over slack @pixelzoom said

I tried something similar with ACID_BASE_SOLUTIONS/MagnifierNode. Line 74, viewportNode, added renderer: 'canvas'. Clipping continues to work fine.

@jessegreenberg
Copy link
Contributor Author

Ah, the clip area is working but doesn't update once set initially with renderer: canvas. Here it is in RIAW:
Image from Gyazo

Confirmed in acid-base-solutions, I modified MagnifierNode to shrink the clipArea over time, here it is with default renderer:
Image from Gyazo

And when viewportNode is given renderer: canvas, the clip area no longer updates.

@jessegreenberg
Copy link
Contributor Author

In the above test in acid-base-solutions, I am updating the clipArea in step. With renderer: canvas, there is no observable update in the clip area in the animation frame, but as I cycle through the radio buttons I do see the clip area shrink:
Image from Gyazo

@jessegreenberg jessegreenberg changed the title Clip areas not working with renderer: canvas Changing clip area does not work with renderer: canvas Jul 17, 2018
@jessegreenberg
Copy link
Contributor Author

Adding block-publication label so this is on the radar before someone goes into an RC. But if someone requires a changing clip area with canvas the issue should be obvious right away before an RC is created.

@zepumph
Copy link
Member

zepumph commented Jul 17, 2018

This is also holding up the next rc release of RIAW, because of phetsims/resistance-in-a-wire#164.

@jonathanolson
Copy link
Contributor

It looks like the listeners for clip area (and Canvas rendering) were not being added to all of the nodes that would potentially affect it. That should be fixed with the above commit.

@jessegreenberg can you verify that this fixes the issue? (snapshot comparison doesn't show any major regressions).

@jessegreenberg
Copy link
Contributor Author

Thanks @jonathanolson! I just verified that this fixes this issue in resistance-in-a-wire, so this can be closed.

@zepumph
Copy link
Member

zepumph commented Aug 14, 2018

This will need to be cherry picked into the RIAW RC branch, reopening and assigning to myself, see phetsims/resistance-in-a-wire#168 for more details.

@zepumph
Copy link
Member

zepumph commented Aug 23, 2018

RIAW has been covered, see phetsims/resistance-in-a-wire#164 (comment). Closing

@zepumph zepumph closed this as completed Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants