bluecadet / Cinder-BluecadetViews

Scene graph Cinder block with touch management and various tools for UI dev
MIT License
11 stars 3 forks source link

Invalidate transform after being added to view #141

Closed shi-weili closed 5 years ago

shi-weili commented 5 years ago

@benjaminbojko I think that the transform of a view need to be invalidated if this view is added to a new parent. Otherwise, touches might not be captured correctly. Its effective touch area will be the old, wrong one, while the view draws in its new, correct position.

benjaminbojko commented 5 years ago

What a great catch! Must have resulted in some annoying debugging :/ I'll review more closely tomorrow, but think that there may be a slightly more safe place to put this that's less prone to be overridden. Thanks for investigating and fixing this!

benjaminbojko commented 5 years ago

@shi-weili Not urgent, but I think before we merge this in, these places would be better to call invalidate from since those are less prone to being overridden by subclasses:

This will also help with removing children from parents (e.g. if you plan on using a view in an FBO or outside of the view hierarchy).

benjaminbojko commented 5 years ago

@shi-weili bumping this so we can merge these fixes in. When you're back, could you take a quick peek?

shi-weili commented 5 years ago

@benjaminbojko Thanks for the suggestions! I've moved the invalidate() call to places you recommended. Quickly compiled a sample project to confirm that the touch sensing still works correctly.

benjaminbojko commented 5 years ago

Beautiful. Thanks @shi-weili .