mirror of
https://github.com/esphome/esphome.git
synced 2026-06-04 17:43:05 +08:00
[lvgl] Fix ext_click_area property application (#15394)
Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
@@ -23,6 +23,7 @@ from esphome.core.config import StartupTrigger
|
|||||||
|
|
||||||
from . import defines as df, lv_validation as lvalid
|
from . import defines as df, lv_validation as lvalid
|
||||||
from .defines import (
|
from .defines import (
|
||||||
|
CONF_EXT_CLICK_AREA,
|
||||||
CONF_SCROLL_DIR,
|
CONF_SCROLL_DIR,
|
||||||
CONF_SCROLL_SNAP_X,
|
CONF_SCROLL_SNAP_X,
|
||||||
CONF_SCROLL_SNAP_Y,
|
CONF_SCROLL_SNAP_Y,
|
||||||
@@ -311,6 +312,7 @@ STYLE_SCHEMA = cv.Schema({cv.Optional(k): v for k, v in STYLE_PROPS.items()}).ex
|
|||||||
cv.Optional(df.CONF_SCROLLBAR_MODE): df.LvConstant(
|
cv.Optional(df.CONF_SCROLLBAR_MODE): df.LvConstant(
|
||||||
"LV_SCROLLBAR_MODE_", "OFF", "ON", "ACTIVE", "AUTO"
|
"LV_SCROLLBAR_MODE_", "OFF", "ON", "ACTIVE", "AUTO"
|
||||||
).one_of,
|
).one_of,
|
||||||
|
cv.Optional(CONF_EXT_CLICK_AREA): lvalid.pixels,
|
||||||
cv.Optional(CONF_SCROLL_DIR): df.SCROLL_DIRECTIONS.one_of,
|
cv.Optional(CONF_SCROLL_DIR): df.SCROLL_DIRECTIONS.one_of,
|
||||||
cv.Optional(CONF_SCROLL_SNAP_X): df.SNAP_DIRECTIONS.one_of,
|
cv.Optional(CONF_SCROLL_SNAP_X): df.SNAP_DIRECTIONS.one_of,
|
||||||
cv.Optional(CONF_SCROLL_SNAP_Y): df.SNAP_DIRECTIONS.one_of,
|
cv.Optional(CONF_SCROLL_SNAP_Y): df.SNAP_DIRECTIONS.one_of,
|
||||||
@@ -318,6 +320,7 @@ STYLE_SCHEMA = cv.Schema({cv.Optional(k): v for k, v in STYLE_PROPS.items()}).ex
|
|||||||
)
|
)
|
||||||
|
|
||||||
OBJ_PROPERTIES = {
|
OBJ_PROPERTIES = {
|
||||||
|
CONF_EXT_CLICK_AREA,
|
||||||
CONF_SCROLL_SNAP_X,
|
CONF_SCROLL_SNAP_X,
|
||||||
CONF_SCROLL_SNAP_Y,
|
CONF_SCROLL_SNAP_Y,
|
||||||
CONF_SCROLL_DIR,
|
CONF_SCROLL_DIR,
|
||||||
@@ -433,7 +436,6 @@ def obj_schema(widget_type: WidgetType):
|
|||||||
return (
|
return (
|
||||||
part_schema(widget_type.parts)
|
part_schema(widget_type.parts)
|
||||||
.extend(ALIGN_TO_SCHEMA)
|
.extend(ALIGN_TO_SCHEMA)
|
||||||
.extend({cv.Optional(df.CONF_EXT_CLICK_AREA): lvalid.pixels})
|
|
||||||
.extend(automation_schema(widget_type.w_type))
|
.extend(automation_schema(widget_type.w_type))
|
||||||
.extend(
|
.extend(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ from .defines import (
|
|||||||
CONF_ALIGN,
|
CONF_ALIGN,
|
||||||
CONF_ALIGN_TO,
|
CONF_ALIGN_TO,
|
||||||
CONF_ALIGN_TO_LAMBDA_ID,
|
CONF_ALIGN_TO_LAMBDA_ID,
|
||||||
CONF_EXT_CLICK_AREA,
|
|
||||||
DIRECTIONS,
|
DIRECTIONS,
|
||||||
LV_EVENT_MAP,
|
LV_EVENT_MAP,
|
||||||
LV_EVENT_TRIGGERS,
|
LV_EVENT_TRIGGERS,
|
||||||
@@ -114,8 +113,6 @@ async def generate_align_tos(config: dict):
|
|||||||
x = align_to[CONF_X]
|
x = align_to[CONF_X]
|
||||||
y = align_to[CONF_Y]
|
y = align_to[CONF_Y]
|
||||||
lv.obj_align_to(w.obj, target, align, x, y)
|
lv.obj_align_to(w.obj, target, align, x, y)
|
||||||
if ext_click_area := w.config.get(CONF_EXT_CLICK_AREA):
|
|
||||||
lv.obj_set_ext_click_area(w.obj, ext_click_area)
|
|
||||||
|
|
||||||
action_id = config[CONF_ALIGN_TO_LAMBDA_ID]
|
action_id = config[CONF_ALIGN_TO_LAMBDA_ID]
|
||||||
var = new_Pvariable(action_id, await context.get_lambda())
|
var = new_Pvariable(action_id, await context.get_lambda())
|
||||||
|
|||||||
Reference in New Issue
Block a user