TakuSemba / Spotlight

Android Library that lights items for tutorials or walk-throughs etc...
Apache License 2.0
3.63k stars 363 forks source link

Feature: finish spotlight on touch outside of current target #129

Open valeryvpetrov-dev opened 2 years ago

valeryvpetrov-dev commented 2 years ago

Problem

I've seen issue https://github.com/TakuSemba/Spotlight/issues/123 (from @aryandii) and decided to help you make Spotlight more functional ✨

Solution

So I added a new flag to make it possible to finish spotlight on touch outside of current target. Let's see how it looks like:

There is a listener to catch on touch outside of current target event. Finishing on touch outside is the only one usage of listener. If you want to add new Shape just create a child class and implement contains function. It can be quite complex if your shape is not primitive. So it can be not perfectly precise (and there is nothing horrible, IMHO). Round rectangle is an example of complex shape:

@TakuSemba , thanks a lot for your work. I hope this feature will improve your project and engage new developers 🤝

valeryvpetrov-dev commented 2 years ago

49c939b increases accuracy. Now touch zone is slightly bigger than target: