diff --git a/docs/overview/scroll.md b/docs/overview/scroll.md index 03e8df9775..e20e4148e8 100644 --- a/docs/overview/scroll.md +++ b/docs/overview/scroll.md @@ -100,7 +100,8 @@ However, with `LV_OBJ_FLAG_SCROLL_ELASTIC` a fancy effect can be added when the When the object is released the content scrolled in it will be animated back to the valid position. ### Snapping -The children of an object can be snapped according to specific rules when scrolling ends. Children can be made snappable individually with the `LV_OBJ_FLAG_SNAPABLE` flag. (Note misspelling of the flag name: your code needs to spell it with one P.) +The children of an object can be snapped according to specific rules when scrolling ends. Children can be made snappable individually with the `LV_OBJ_FLAG_SNAPPABLE` flag. + The object can align the snapped children in 4 ways: - `LV_SCROLL_SNAP_NONE` Snapping is disabled. (default) - `LV_SCROLL_SNAP_START` Align the children to the left/top side of the scrolled object @@ -117,7 +118,7 @@ Under the hood the following happens: ### Scroll one The "scroll one" feature tells LVGL to allow scrolling only one snappable child at a time. -So this requires to make the children snappable (LV_OBJ_FLAG_SNAPABLE spelled with one P in code) and and set a scroll snap alignment different from `LV_SCROLL_SNAP_NONE`. +So this requires to make the children snappable and set a scroll snap alignment different from `LV_SCROLL_SNAP_NONE`. This feature can be enabled by the `LV_OBJ_FLAG_SCROLL_ONE` flag. diff --git a/docs/widgets/obj.md b/docs/widgets/obj.md index 05e9f114b8..188af5e5d9 100644 --- a/docs/widgets/obj.md +++ b/docs/widgets/obj.md @@ -104,10 +104,10 @@ There are some attributes which can be enabled/disabled by `lv_obj_add/clear_fla - `LV_OBJ_FLAG_SCROLLABLE` Make the object scrollable - `LV_OBJ_FLAG_SCROLL_ELASTIC` Allow scrolling inside but with slower speed - `LV_OBJ_FLAG_SCROLL_MOMENTUM` Make the object scroll further when "thrown" -- `LV_OBJ_FLAG_SCROLL_ONE` Allow scrolling only one snapable children +- `LV_OBJ_FLAG_SCROLL_ONE` Allow scrolling only one snappable children - `LV_OBJ_FLAG_SCROLL_CHAIN` Allow propagating the scroll to a parent - `LV_OBJ_FLAG_SCROLL_ON_FOCUS` Automatically scroll object to make it visible when focused -- `LV_OBJ_FLAG_SNAPABLE` If scroll snap is enabled on the parent it can snap to this object +- `LV_OBJ_FLAG_SNAPPABLE` If scroll snap is enabled on the parent it can snap to this object - `LV_OBJ_FLAG_PRESS_LOCK` Keep the object pressed even if the press slid from the object - `LV_OBJ_FLAG_EVENT_BUBBLE` Propagate the events to the parent too - `LV_OBJ_FLAG_GESTURE_BUBBLE` Propagate the gestures to the parent diff --git a/examples/scroll/lv_example_scroll_2.py b/examples/scroll/lv_example_scroll_2.py index 37c00f4412..5e5b97da1b 100644 --- a/examples/scroll/lv_example_scroll_2.py +++ b/examples/scroll/lv_example_scroll_2.py @@ -28,7 +28,7 @@ for i in range(10): label = lv.label(btn) if i == 3: label.set_text("Panel {:d}\nno snap".format(i)) - btn.clear_flag(lv.obj.FLAG.SNAPABLE) + btn.clear_flag(lv.obj.FLAG.SNAPPABLE) else: label.set_text("Panel {:d}".format(i)) label.center() diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index a1d9afb5bd..d769d1871d 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -94,7 +94,7 @@ enum { LV_OBJ_FLAG_SCROLLABLE = (1 << 4), /**< Make the object scrollable*/ LV_OBJ_FLAG_SCROLL_ELASTIC = (1 << 5), /**< Allow scrolling inside but with slower speed*/ LV_OBJ_FLAG_SCROLL_MOMENTUM = (1 << 6), /**< Make the object scroll further when "thrown"*/ - LV_OBJ_FLAG_SCROLL_ONE = (1 << 7), /**< Allow scrolling only one snapable children*/ + LV_OBJ_FLAG_SCROLL_ONE = (1 << 7), /**< Allow scrolling only one snappable children*/ LV_OBJ_FLAG_SCROLL_CHAIN = (1 << 8), /**< Allow propagating the scroll to a parent*/ LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1 << 9), /**< Automatically scroll object to make it visible when focused*/ LV_OBJ_FLAG_SNAPPABLE = (1 << 10), /**< If scroll snap is enabled on the parent it can snap to this object*/ @@ -148,8 +148,8 @@ typedef struct { lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/ lv_scrollbar_mode_t scrollbar_mode :2; /**< How to display scrollbars*/ - lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snapable children horizontally*/ - lv_scroll_snap_t scroll_snap_y : 2; /**< Where to align the snapable children horizontally*/ + lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally*/ + lv_scroll_snap_t scroll_snap_y : 2; /**< Where to align the snappable children horizontally*/ lv_dir_t scroll_dir :4; /**< The allowed scroll direction(s)*/ uint8_t event_dsc_cnt; /**< Number of event callabcks stored in `event_cb` array*/ }_lv_obj_spec_attr_t; diff --git a/src/core/lv_obj_scroll.h b/src/core/lv_obj_scroll.h index c7fda4abd0..d79fa8ee6e 100644 --- a/src/core/lv_obj_scroll.h +++ b/src/core/lv_obj_scroll.h @@ -37,7 +37,7 @@ enum { typedef uint8_t lv_scrollbar_mode_t; -/** Scroll span align options. Tells where to align the snapable children when scroll stops.*/ +/** Scroll span align options. Tells where to align the snappable children when scroll stops.*/ enum { LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/ LV_SCROLL_SNAP_START, /**< Align to to the left/top*/