From 7125374fa35eb43788d6388850560fc29a53a4ea Mon Sep 17 00:00:00 2001 From: Christian Riggenbach Date: Fri, 8 Mar 2019 22:22:01 +0100 Subject: [PATCH] Color of elementes are now updateable, reformatted control.js --- data/js/controls.js | 376 +++++++++++------------------ data/js/controls.min.js | 205 ++++------------ examples/gui-newAPI/gui-newAPI.ino | 12 +- examples/tabbedGui/tabbedGui.ino | 11 +- src/ESPUI.cpp | 39 ++- src/ESPUI.h | 24 +- src/dataControlsJS.h | 207 ++++------------ src/dataIndexHTML.h | 2 +- src/dataNormalizeCSS.h | 2 +- src/dataSliderJS.h | 2 +- src/dataStyleCSS.h | 2 +- src/dataTabbedcontentJS.h | 2 +- src/dataZeptoJS.h | 2 +- 13 files changed, 317 insertions(+), 569 deletions(-) diff --git a/data/js/controls.js b/data/js/controls.js index 6b33403..8cf947c 100644 --- a/data/js/controls.js +++ b/data/js/controls.js @@ -1,9 +1,16 @@ const UI_INITIAL_GUI = 200; +const UPDATE_OFFSET = 100; const UI_TITEL = 0; -const UI_BUTTON = 1; -const UI_PAD = 2; -const UI_CPAD = 3; + +const UI_PAD = 1; +const UPDATE_PAD = 101; + +const UI_CPAD = 2; +const UPDATE_CPAD = 102; + +const UI_BUTTON = 3; +const UPDATE_BUTTON = 103; const UI_LABEL = 4; const UPDATE_LABEL = 104; @@ -32,8 +39,8 @@ const UPDATE_SELECT = 112; const UI_OPTION = 13; const UPDATE_OPTION = 113; -const FOR = 0; -const BACK = 1; +const UP = 0; +const DOWN = 1; const LEFT = 2; const RIGHT = 3; const CENTER = 4; @@ -143,158 +150,92 @@ function start() { handleEvent(fauxEvent); }); break; + case UI_TITEL: document.title = data.label; $("#mainHeader").html(data.label); break; + case UI_LABEL: - var element; + var parent; if(data.parentControl) { - element = $("#tab"+data.parentControl); + parent = $("#tab"+data.parentControl); } else { - element = $("#row") + parent = $("#row") } - element.append( - "
" + - data.label + - "

" + - data.value + - "
" + parent.append( + "
" + + "
" + data.label + "

" + + "" + data.value + "" + + "
" ); break; + case UI_BUTTON: - var element; + var parent; if(data.parentControl) { - element = $("#tab"+data.parentControl); + parent = $("#tab"+data.parentControl); } else { - element = $("#row") + parent = $("#row") } - element.append( - "
" + - data.label + - "

" + "" ); - $("#" + data.id).on({ + $("#btn" + data.id).on({ touchstart: function(e) { e.preventDefault(); buttonclick(data.id, true); - } - }); - $("#" + data.id).on({ + }, touchend: function(e) { e.preventDefault(); buttonclick(data.id, false); } }); break; + case UI_SWITCHER: - var label = "