bluecadet / Cinder-BluecadetViews

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

Bug where touches could get sent to invisible views #92

Closed mattfelsen closed 7 years ago

mattfelsen commented 7 years ago

@benjaminbojko and I found that views which are not set to hidden but have an alpha of 0 could still receive touches. The culprit is here: https://github.com/bluecadet/Cinder-BluecadetViews/blob/da01821eb50e04fc5ec9bb314a15f2ab367b1887/src/bluecadet/touch/TouchManager.cpp#L257

Changing this check: if (rootView->isHidden()) to: if (rootView->isHidden() || rootView->getAlpha() <= TouchView::sDefaultMinAlphaForTouches)

provides a suitable workaround for me for now, but uses the default min alpha rather than that view's specific setting. We also don't know at this point if the view being checked if a BaseView or TouchView so getMinAlphaForTouches() can't be called without a dynamic_cast/dynamic_pointer_cast check first, which may be slow?

benjaminbojko commented 7 years ago

This was fixed in #92