LVGL Mirroring add checkbox to enable/disable the feature (#23047)

This commit is contained in:
s-hadinger 2025-02-22 12:00:36 +01:00 committed by GitHub
parent b8459eb685
commit 1db796c40f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 2 deletions

View File

@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
### Changed ### Changed
- LVGL, prepare for HASPmota theme, change: no-grow when clicked, DPI set to 160 - LVGL, prepare for HASPmota theme, change: no-grow when clicked, DPI set to 160
- LVGL Mirroring add checkbox to enable/disable the feature (in the iterim for a better solution)
### Fixed ### Fixed

View File

@ -1018,8 +1018,13 @@ class lvgl_panel
'<tbody>' '<tbody>'
'<tr>' '<tr>'
'<td>' '<td>'
'<fieldset style="background-color:{tasmota.webcolor(1)};"><legend style="text-align:left;">&nbsp;LVGL screen mirroring&nbsp;</legend>' '<fieldset style="background-color:{tasmota.webcolor(1)};">'
'<iframe id="lvgl_iframe" src="http://{ip}:{self.port}/lvgl" ' '<legend style="text-align:left;">'
'<label>'
'<input type="checkbox" id="lvchk">&nbsp;LVGL screen mirroring&nbsp;'
'</label>'
'</legend>'
'<iframe id="lvgl_iframe" src="about:blank" hidden="true"'
'style="color:#eaeaea; border:0px none;height:{height}px;width:{width}px;margin:0px 8px 0px 8px;padding:0px 0px;">' 'style="color:#eaeaea; border:0px none;height:{height}px;width:{width}px;margin:0px 8px 0px 8px;padding:0px 0px;">'
'</iframe>' '</iframe>'
'</fieldset>' '</fieldset>'
@ -1027,6 +1032,30 @@ class lvgl_panel
'</tr>' '</tr>'
'</tbody>' '</tbody>'
'</table>' '</table>'
'<script>'
'const lvuri="http://{ip}:{self.port}/lvgl";'
'</script>'
)
webserver.content_send(
'<script>'
'function lvg(){'
'lvchk=eb("lvchk");'
# checkbox event
'lvchk.addEventListener("change",(event)=>{'
'const iframe=document.getElementById("lvgl_iframe");'
'if(lvchk.checked){'
# When checked, reload the original content
'iframe.src=lvuri;'
'iframe.hidden=false;'
'}else{'
# When unchecked, replace iframe with itself to unload it
'iframe.src="about:blank";'
'iframe.hidden=true;'
'}'
'});'
'}'
'wl(lvg);'
'</script>'
) )
end end
end end