Просмотр исходного кода

update:更新lcd演示demo内坐标参数为整数

江访 1 месяц назад
Родитель
Сommit
f542f84dcf

+ 1 - 1
module/Air780EHM_Air780EHV_Air780EGH/demo/accessory_board/AirLCD_1010/lcd/ui/home_page.lua

@@ -20,7 +20,7 @@ local home_page = {}
 -- 屏幕尺寸
 local width, height = lcd.getSize()
 
-local center_x = width / 2
+local center_x = math.floor(width / 2)
 
 -- 按钮区域定义
 local buttons = {

+ 1 - 1
module/Air8000/demo/accessory_board/AirLCD_1010/lcd/ui/home_page.lua

@@ -48,7 +48,7 @@ function home_page.draw()
     -- 显示标题
     -- 后续V2020版本以上支持lcd核心库的固件会新增lcd.getStrWidth(title)接口获取文本宽度,对齐、居中、换行可使用
     -- width, height = lcd.getSize()
-    -- center_x = width / 2
+    -- center_x = math.floor(width / 2)
     -- lcd.drawStr(center_x - lcd.getStrWidth(title) / 2, 50, title, 0x0000) -- 自动居中
     lcd.drawStr(106, 50, title, 0x0000)
 

+ 1 - 1
module/Air8101/demo/accessory_board/AirLCD_1020/lcd/ui/home_page.lua

@@ -45,7 +45,7 @@ function home_page.draw()
     lcd.setFont(lcd.font_opposansm12_chinese)
 
     width, height = lcd.getSize()
-    center_x = width / 2
+    center_x = math.floor(width / 2)
 
     -- 显示标题(居中)
     -- 后续V2020版本以上支持lcd核心库的固件会新增lcd.getStrWidth(title)接口获取文本宽度,对齐、居中、换行可使用