Repository navigation
fix(arc): ignore hits that are outside drawn background arc - #6753
Conversation
liamHowatt
left a comment
There was a problem hiding this comment.
Awesome!
Nice application of LV_OBJ_FLAG_ADV_HITTEST.
|
Nice! Could you add a test and mention this behavior in the docs as well? |
|
Fyi the CI is failing because In the defines section at the top #if LV_USE_FLOAT
#define VALUE_PRECISE_MOD(x, y) fmodf((x), (y))
#else
#define VALUE_PRECISE_MOD(x, y) (x) % (y)
#endifAnd then you can do angle = VALUE_PRECISE_MOD(VALUE_PRECISE_MOD(angle, 360) + 360, 360); |
|
I had a similar idea in mind, but was unsure of it would cause trouble including the math.h lib. while (angle >= 360) angle -= 360;
while (angle < 0) angle += 360;This works without having to add any dependency, but feels wasteful to me, not that i any test either one would be faster. I haven't pushed this yet as I'm first trying to set up the unit tests for this case. |
I wasn't 100% sure what to do for the documentation. would changing the paragraph Lines 108 to 116 in 2c021b6 |
|
I also vote for Regarding the docs: based on the latest code I think this is happening: Interactive area
----------------
By default :cpp:enumerator:`LV_OBJ_FLAG_ADV_HITTEST` is disabled which
means the arc's whole area is interactive.
As usual :cpp:func:`lv_obj_set_ext_click_size` can be used to increase
the sensitive area outside the arc by a specified number of pixels.
If :cpp:enumerator:`LV_OBJ_FLAG_ADV_HITTEST` is enabled the arc will be sensitive only
in the range of start and end background angles and on the arc itself (not inside the arc).
In this case ``ext_click_size`` makes the sensitive area ticker both inward and outward. Please check if it's correct. |
|
Sounds good, i think it explains it nicely! I've added a small part to include the extended arc ranges. |
Summary:
When two arcs share the same center and radius but have non-overlapping background angles, the lower arc is not interactable. The current implementation checks whether the interaction is at the correct distance from the center but does not verify if it falls within the correct arc range.
Changes:
Added an arc range check to ensure that the interaction occurs within the specified angles of the arc.
Implementation Details:
The code checks the angular range of the arcs, in addition to the existing distance check, to determine if the interaction should be processed. This logic is based on similar checks already implemented in the LV_EVENT_PRESSING event, as referenced in #4576 .
Example Usage:
Testing:
Tested with overlapping and non-overlapping arcs with the same center and radius.
Verified that interactions are processed correctly based on the angular range.
Notes:
This change ensures that arcs with distinct background angles remain independently interactable even when they share the same center and radius.
Notes:
lv_conf_template.hrun lv_conf_internal_gen.py and update Kconfig.scripts/code-format.py(astyle v3.4.12needs to installed by runningcd scripts; ./install_astyle.sh) and follow the Code Conventions.