From 987fb34063eb47da0b6285f8ef814e3ff050e035 Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Mon, 26 Feb 2024 15:49:16 +0400 Subject: [PATCH 1/9] selection and cursor pos --- druid/const.lua | 1 + druid/custom/rich_input/rich_input.gui | 95 ++++++++++++++- druid/custom/rich_input/rich_input.lua | 115 +++++++++++++++++- druid/extended/input.lua | 5 +- .../examples/custom/rich_input/rich_input.gui | 105 +++++++++++++++- input/game.input_binding | 4 + 6 files changed, 309 insertions(+), 16 deletions(-) diff --git a/druid/const.lua b/druid/const.lua index 86f674e4..3b08a6c4 100755 --- a/druid/const.lua +++ b/druid/const.lua @@ -15,6 +15,7 @@ M.ACTION_BACK = hash(sys.get_config("druid.input_key_back", "key_back")) M.ACTION_ENTER = hash(sys.get_config("druid.input_key_enter", "key_enter")) M.ACTION_MULTITOUCH = hash(sys.get_config("druid.input_multitouch", "touch_multi")) M.ACTION_BACKSPACE = hash(sys.get_config("druid.input_key_backspace", "key_backspace")) +M.ACTION_DEL = hash(sys.get_config("druid.input_key_del", "key_del")) M.ACTION_SCROLL_UP = hash(sys.get_config("druid.input_scroll_up", "mouse_wheel_up")) M.ACTION_SCROLL_DOWN = hash(sys.get_config("druid.input_scroll_down", "mouse_wheel_down")) diff --git a/druid/custom/rich_input/rich_input.gui b/druid/custom/rich_input/rich_input.gui index b511cec5..0b27964f 100644 --- a/druid/custom/rich_input/rich_input.gui +++ b/druid/custom/rich_input/rich_input.gui @@ -33,8 +33,8 @@ nodes { w: 1.0 } size { - x: 1.0 - y: 1.0 + x: 200.0 + y: 100.0 z: 0.0 w: 1.0 } @@ -66,6 +66,10 @@ nodes { alpha: 1.0 template_node_child: false size_mode: SIZE_MODE_AUTO + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -87,8 +91,8 @@ nodes { w: 1.0 } size { - x: 190.0 - y: 45.0 + x: 200.0 + y: 100.0 z: 0.0 w: 1.0 } @@ -121,6 +125,10 @@ nodes { alpha: 1.0 template_node_child: false size_mode: SIZE_MODE_AUTO + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -184,6 +192,10 @@ nodes { template_node_child: false text_leading: 1.0 text_tracking: 0.0 + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -247,6 +259,10 @@ nodes { template_node_child: false text_leading: 1.0 text_tracking: 0.0 + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -268,8 +284,8 @@ nodes { w: 1.0 } size { - x: 1.0 - y: 1.0 + x: 200.0 + y: 100.0 z: 0.0 w: 1.0 } @@ -302,6 +318,10 @@ nodes { alpha: 1.0 template_node_child: false size_mode: SIZE_MODE_AUTO + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -365,6 +385,69 @@ nodes { template_node_child: false text_leading: 1.0 text_tracking: 0.0 + custom_type: 0 + enabled: true + visible: true + material: "" +} +nodes { + position { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + size { + x: 100.0 + y: 30.0 + z: 0.0 + w: 1.0 + } + color { + x: 0.302 + y: 0.4 + z: 0.8 + w: 1.0 + } + type: TYPE_BOX + blend_mode: BLEND_MODE_ALPHA + texture: "" + id: "highlight_node" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + adjust_mode: ADJUST_MODE_FIT + parent: "button" + layer: "" + inherit_alpha: true + slice9 { + x: 0.0 + y: 0.0 + z: 0.0 + w: 0.0 + } + clipping_mode: CLIPPING_MODE_NONE + clipping_visible: true + clipping_inverted: false + alpha: 0.35 + template_node_child: false + size_mode: SIZE_MODE_MANUAL + custom_type: 0 + enabled: false + visible: true + material: "" } material: "/builtins/materials/gui.material" adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index feae3920..a75668dd 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -19,8 +19,9 @@ -- @tfield druid.text placeholder @{Text} --- - +local const = require("druid.const") local component = require("druid.component") +local utf8 = require("druid.system.utf8") local RichInput = component.create("druid.rich_input") @@ -30,8 +31,53 @@ local SCHEME = { PLACEHOLDER = "placeholder_text", INPUT = "input_text", CURSOR = "cursor_node", + HIGHLIGHT = "highlight_node", } +local function set_cursor(self,to_index) + if self.input:get_text() == "" then + gui.set_position(self.cursor, vmath.vector3(0, 0, 0)) + return + end + + --if self.hold_cursor then + + + --else + -- gui.set_position(self.cursor, vmath.vector3(self.input.total_width/2, 0, 0)) + --end + + + if to_index then + local text = self.input:get_text() + local cursor_width = self.text:get_text_size("|")/2 + local gap = self.input.total_width/2 * -1 + local cursor_delta = 0 + cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.cursor_letter_index)) - cursor_width + gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) + return + end + + if self.touch_pos_x then + local text = self.input:get_text() + local node_pos = gui.get_screen_position(self.highlight) + local touch_delta_x = self.touch_pos_x - node_pos.x + local letters_count = utf8.len(self.input:get_text()) + local cursor_width = self.text:get_text_size("|")/2 + local cursor_delta = 0 + local gap = self.input.total_width/2 * -1 + + for i = 1, letters_count do + cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, i)) - cursor_width + if cursor_delta <= touch_delta_x then + gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) + self.cursor_letter_index = i + end + end + self.touch_pos_x = nil + end +end + local function animate_cursor(self) gui.cancel_animation(self.cursor, gui.PROP_COLOR) @@ -42,14 +88,20 @@ end local function update_text(self, text) local text_width = self.input.total_width + local text_height = self.input.text_height animate_cursor(self) - gui.set_position(self.cursor, vmath.vector3(text_width/2, 0, 0)) + + set_cursor(self, true) + --gui.set_position(self.cursor, vmath.vector3(text_width/2, 0, 0)) gui.set_scale(self.cursor, self.input.text.scale) + gui.set_size(self.highlight, vmath.vector3(text_width, text_height, 0)) end local function on_select(self) + self.cursor_letter_index = utf8.len(self.input:get_text()) gui.set_enabled(self.cursor, true) + gui.set_enabled(self.highlight, false) gui.set_enabled(self.placeholder.node, false) animate_cursor(self) end @@ -57,10 +109,27 @@ end local function on_unselect(self) gui.set_enabled(self.cursor, false) + gui.set_enabled(self.highlight, false) gui.set_enabled(self.placeholder.node, true and #self.input:get_text() == 0) end +local function on_button_click(self) + gui.set_enabled(self.highlight, false) + gui.set_enabled(self.cursor, true) + self.text:set_to(self.input:get_text()) + + set_cursor(self) +end + + +local function on_button_double_click(self) + if #self.input:get_text() > 0 then + gui.set_enabled(self.highlight, true) + gui.set_enabled(self.cursor, false) + end +end + --- Component init function -- @tparam RichInput self @{RichInput} -- @tparam string template The template string name @@ -71,13 +140,24 @@ function RichInput.init(self, template, nodes) self.druid = self:get_druid() self.input = self.druid:new_input(self:get_node(SCHEME.BUTTON), self:get_node(SCHEME.INPUT)) self.cursor = self:get_node(SCHEME.CURSOR) - + self.highlight = self:get_node(SCHEME.HIGHLIGHT) + + self.cursor_letter_index = 0 -- index of a letter before the cursor + self.hold_cursor = false + --self.touch_pos_x = nil --screen x position of a touch for cursor pos calculations + self.input:set_text("") self.placeholder = self.druid:new_text(self:get_node(SCHEME.PLACEHOLDER)) + self.text = self.druid:new_text(self:get_node(SCHEME.INPUT)) self.input.on_input_text:subscribe(update_text) self.input.on_input_select:subscribe(on_select) self.input.on_input_unselect:subscribe(on_unselect) + + self.input.button.on_click:subscribe(on_button_click, self) + self.input.button.on_double_click:subscribe(on_button_double_click, self) + self.input.style.NO_CONSUME_INPUT_WHILE_SELECTED = true + on_unselect(self) update_text(self, "") end @@ -91,5 +171,34 @@ function RichInput.set_placeholder(self, placeholder_text) return self end +function RichInput.on_input(self, action_id, action) + self.touch_pos_x = action.screen_x + if gui.is_enabled(self.highlight) then + if action_id == const.ACTION_BACKSPACE or action_id == const.ACTION_DEL then + self.input:set_text("") + update_text(self, "") + on_select(self) + end + else + if action_id == const.ACTION_DEL and action.pressed then + local text = self.input:get_text() + local new_text = utf8.sub(text, 1, self.cursor_letter_index) .. utf8.sub(text, self.cursor_letter_index +2 ) + self.input:set_text(new_text) + self.hold_cursor = true + update_text(self, new_text) + end + + --[[ а вот такой блок не работает как надо, т.к. родительский компонент -INPUT первым обрабатывает сообщение ввода и отжирает одну букву до того, как очередь придёт сюда + if action_id == const.ACTION_BACKSPACE and action.pressed then + local text = self.input:get_text() + local new_text = utf8.sub(text, 1, self.cursor_letter_index-1) .. utf8.sub(text, self.cursor_letter_index +1 ) + self.cursor_letter_index = self.cursor_letter_index -1 + self.input:set_text(new_text) + update_text(self, new_text) + end + --]] + end + return true +end return RichInput diff --git a/druid/extended/input.lua b/druid/extended/input.lua index f08ac6b7..4bf18f90 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -137,6 +137,7 @@ function Input.init(self, click_node, text_node, keyboard_type) self.is_empty = true self.text_width = 0 + self.text_height = 0 self.market_text_width = 0 self.total_width = 0 @@ -164,6 +165,7 @@ end function Input.on_input(self, action_id, action) + --print("Input.lua",action_id) if self.is_selected then local input_text = nil if action_id == const.ACTION_TEXT then @@ -270,7 +272,8 @@ function Input.set_text(self, input_text) self.text:set_to(final_text) -- measure it - self.text_width = self.text:get_text_size(value) + self.text_width, self.text_height = self.text:get_text_size(value) + self.marked_text_width = self.text:get_text_size(marked_value) self.total_width = self.text_width + self.marked_text_width diff --git a/example/examples/custom/rich_input/rich_input.gui b/example/examples/custom/rich_input/rich_input.gui index 51c3ec72..b1323648 100644 --- a/example/examples/custom/rich_input/rich_input.gui +++ b/example/examples/custom/rich_input/rich_input.gui @@ -66,6 +66,10 @@ nodes { alpha: 1.0 template_node_child: false size_mode: SIZE_MODE_MANUAL + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -129,6 +133,10 @@ nodes { template_node_child: false text_leading: 1.0 text_tracking: 0.0 + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -169,6 +177,8 @@ nodes { alpha: 1.0 template: "/druid/custom/rich_input/rich_input.gui" template_node_child: false + custom_type: 0 + enabled: true } nodes { position { @@ -190,8 +200,8 @@ nodes { w: 1.0 } size { - x: 1.0 - y: 1.0 + x: 200.0 + y: 100.0 z: 0.0 w: 1.0 } @@ -224,6 +234,10 @@ nodes { alpha: 1.0 template_node_child: true size_mode: SIZE_MODE_AUTO + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -245,8 +259,8 @@ nodes { w: 1.0 } size { - x: 190.0 - y: 45.0 + x: 200.0 + y: 100.0 z: 0.0 w: 1.0 } @@ -279,6 +293,10 @@ nodes { alpha: 1.0 template_node_child: true size_mode: SIZE_MODE_AUTO + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -342,6 +360,10 @@ nodes { template_node_child: true text_leading: 1.0 text_tracking: 0.0 + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -405,6 +427,10 @@ nodes { template_node_child: true text_leading: 1.0 text_tracking: 0.0 + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -426,8 +452,8 @@ nodes { w: 1.0 } size { - x: 1.0 - y: 1.0 + x: 200.0 + y: 100.0 z: 0.0 w: 1.0 } @@ -460,6 +486,10 @@ nodes { alpha: 1.0 template_node_child: true size_mode: SIZE_MODE_AUTO + custom_type: 0 + enabled: true + visible: true + material: "" } nodes { position { @@ -523,6 +553,69 @@ nodes { template_node_child: true text_leading: 1.0 text_tracking: 0.0 + custom_type: 0 + enabled: true + visible: true + material: "" +} +nodes { + position { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + rotation { + x: 0.0 + y: 0.0 + z: 0.0 + w: 1.0 + } + scale { + x: 1.0 + y: 1.0 + z: 1.0 + w: 1.0 + } + size { + x: 100.0 + y: 30.0 + z: 0.0 + w: 1.0 + } + color { + x: 0.302 + y: 0.4 + z: 0.8 + w: 1.0 + } + type: TYPE_BOX + blend_mode: BLEND_MODE_ALPHA + texture: "" + id: "rich_input/highlight_node" + xanchor: XANCHOR_NONE + yanchor: YANCHOR_NONE + pivot: PIVOT_CENTER + adjust_mode: ADJUST_MODE_FIT + parent: "rich_input/button" + layer: "" + inherit_alpha: true + slice9 { + x: 0.0 + y: 0.0 + z: 0.0 + w: 0.0 + } + clipping_mode: CLIPPING_MODE_NONE + clipping_visible: true + clipping_inverted: false + alpha: 0.35 + template_node_child: true + size_mode: SIZE_MODE_MANUAL + custom_type: 0 + enabled: false + visible: true + material: "" } layers { name: "image" diff --git a/input/game.input_binding b/input/game.input_binding index e42b4b5f..afafb146 100644 --- a/input/game.input_binding +++ b/input/game.input_binding @@ -30,6 +30,10 @@ key_trigger { input: KEY_G action: "key_g" } +key_trigger { + input: KEY_DEL + action: "key_del" +} mouse_trigger { input: MOUSE_WHEEL_UP action: "mouse_wheel_up" From 65ac7a4a39f754f8865044815689559c074855fa Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Tue, 27 Feb 2024 12:39:57 +0400 Subject: [PATCH 2/9] forward and backward delete fix --- druid/custom/rich_input/rich_input.lua | 97 +++++++++++++++++--------- druid/extended/input.lua | 8 ++- 2 files changed, 70 insertions(+), 35 deletions(-) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index a75668dd..a6c2ca6e 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -34,30 +34,27 @@ local SCHEME = { HIGHLIGHT = "highlight_node", } -local function set_cursor(self,to_index) - if self.input:get_text() == "" then +local function set_cursor(self) + --[[ + if self.input:get_text() == "" then gui.set_position(self.cursor, vmath.vector3(0, 0, 0)) + self.cursor_letter_index = 0 return end - --if self.hold_cursor then - - - --else - -- gui.set_position(self.cursor, vmath.vector3(self.input.total_width/2, 0, 0)) - --end - - - if to_index then + if self.hold_cursor then local text = self.input:get_text() local cursor_width = self.text:get_text_size("|")/2 local gap = self.input.total_width/2 * -1 local cursor_delta = 0 cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.cursor_letter_index)) - cursor_width - gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) + gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) + self.hold_cursor = false return + else + gui.set_position(self.cursor, vmath.vector3(self.input.total_width/2, 0, 0)) end - + --]] if self.touch_pos_x then local text = self.input:get_text() local node_pos = gui.get_screen_position(self.highlight) @@ -75,6 +72,13 @@ local function set_cursor(self,to_index) end end self.touch_pos_x = nil + else + local text = self.input:get_text() + local cursor_width = self.text:get_text_size("|")/2 + local gap = self.input.total_width/2 * -1 + local cursor_delta = 0 + cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.cursor_letter_index)) - cursor_width + gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) end end @@ -86,15 +90,32 @@ local function animate_cursor(self) end -local function update_text(self, text) +local function update_text(self) local text_width = self.input.total_width local text_height = self.input.text_height animate_cursor(self) - - set_cursor(self, true) --gui.set_position(self.cursor, vmath.vector3(text_width/2, 0, 0)) gui.set_scale(self.cursor, self.input.text.scale) gui.set_size(self.highlight, vmath.vector3(text_width, text_height, 0)) + set_cursor(self) +end + + +local function clear_text(self, replace_with_symbol) + local spacer = replace_with_symbol or "" + self.input:set_text(spacer) + update_text(self) + + if replace_with_symbol then + gui.set_position(self.cursor, vmath.vector3(self.input.total_width/2, 0, 0)) + self.cursor_letter_index = 1 + else + gui.set_position(self.cursor, vmath.vector3(0, 0, 0)) + self.cursor_letter_index = 1 + end + + gui.set_enabled(self.highlight, false) + gui.set_enabled(self.cursor, true) end @@ -115,10 +136,10 @@ end local function on_button_click(self) + self.touch_pos_x = self.action_pos_x gui.set_enabled(self.highlight, false) gui.set_enabled(self.cursor, true) self.text:set_to(self.input:get_text()) - set_cursor(self) end @@ -142,11 +163,10 @@ function RichInput.init(self, template, nodes) self.cursor = self:get_node(SCHEME.CURSOR) self.highlight = self:get_node(SCHEME.HIGHLIGHT) - self.cursor_letter_index = 0 -- index of a letter before the cursor - self.hold_cursor = false - --self.touch_pos_x = nil --screen x position of a touch for cursor pos calculations + self.cursor_letter_index = 1 + self.action_pos_x = nil - self.input:set_text("") + --self.input:set_text("") self.placeholder = self.druid:new_text(self:get_node(SCHEME.PLACEHOLDER)) self.text = self.druid:new_text(self:get_node(SCHEME.INPUT)) @@ -157,9 +177,11 @@ function RichInput.init(self, template, nodes) self.input.button.on_click:subscribe(on_button_click, self) self.input.button.on_double_click:subscribe(on_button_double_click, self) self.input.style.NO_CONSUME_INPUT_WHILE_SELECTED = true + self.input.style.SKIP_INPUT_KEYS = true - on_unselect(self) - update_text(self, "") + on_unselect(self) + clear_text(self) + --update_text(self, "") end @@ -172,31 +194,40 @@ function RichInput.set_placeholder(self, placeholder_text) end function RichInput.on_input(self, action_id, action) - self.touch_pos_x = action.screen_x + self.action_pos_x = action.screen_x + if gui.is_enabled(self.highlight) then if action_id == const.ACTION_BACKSPACE or action_id == const.ACTION_DEL then - self.input:set_text("") - update_text(self, "") + clear_text(self) on_select(self) + elseif action_id == const.ACTION_TEXT then + clear_text(self, action.text) end else if action_id == const.ACTION_DEL and action.pressed then local text = self.input:get_text() local new_text = utf8.sub(text, 1, self.cursor_letter_index) .. utf8.sub(text, self.cursor_letter_index +2 ) self.input:set_text(new_text) - self.hold_cursor = true - update_text(self, new_text) - end - - --[[ а вот такой блок не работает как надо, т.к. родительский компонент -INPUT первым обрабатывает сообщение ввода и отжирает одну букву до того, как очередь придёт сюда + update_text(self) + end if action_id == const.ACTION_BACKSPACE and action.pressed then local text = self.input:get_text() local new_text = utf8.sub(text, 1, self.cursor_letter_index-1) .. utf8.sub(text, self.cursor_letter_index +1 ) self.cursor_letter_index = self.cursor_letter_index -1 self.input:set_text(new_text) - update_text(self, new_text) + update_text(self) end - --]] + if action_id == const.ACTION_TEXT then + self.cursor_letter_index = self.cursor_letter_index +1 + update_text(self) + end + + self.touch_pos_x = nil + + if utf8.len(self.input:get_text()) <=0 then + self.cursor_letter_index = 1 + end + end return true end diff --git a/druid/extended/input.lua b/druid/extended/input.lua index 4bf18f90..d4628294 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -91,6 +91,7 @@ end -- @tfield[opt=*] string MASK_DEFAULT_CHAR Default character mask for password input -- @tfield[opt=false] bool IS_UNSELECT_ON_RESELECT If true, call unselect on select selected input -- @tfield[opt=false] bool NO_CONSUME_INPUT_WHILE_SELECTED If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) +-- @tfield[opt=false] bool SKIP_INPUT_KEYS If true, input component will skip processing keys input allowing to process it completely in other components -- @tfield function on_select (self, button_node) Callback on input field selecting -- @tfield function on_unselect (self, button_node) Callback on input field unselecting -- @tfield function on_input_wrong (self, button_node) Callback on wrong user input @@ -102,6 +103,7 @@ function Input.on_style_change(self, style) self.style.MASK_DEFAULT_CHAR = style.MASK_DEFAULT_CHAR or "*" self.style.IS_UNSELECT_ON_RESELECT = style.IS_UNSELECT_ON_RESELECT or false self.style.NO_CONSUME_INPUT_WHILE_SELECTED = style.NO_CONSUME_INPUT_WHILE_SELECTED or false + self.style.SKIP_INPUT_KEYS = style.SKIP_INPUT_KEYS or false self.style.on_select = style.on_select or function(_, button_node) end self.style.on_unselect = style.on_unselect or function(_, button_node) end @@ -200,7 +202,7 @@ function Input.on_input(self, action_id, action) end end - if action_id == const.ACTION_BACKSPACE and (action.pressed or action.repeated) then + if action_id == const.ACTION_BACKSPACE and (action.pressed or action.repeated) and not self.style.SKIP_INPUT_KEYS then input_text = utf8.sub(self.value, 1, -2) end @@ -221,10 +223,12 @@ function Input.on_input(self, action_id, action) if input_text or #self.marked_value > 0 then self:set_text(input_text) - return true + --return true end + end + local is_consume_input = not self.style.NO_CONSUME_INPUT_WHILE_SELECTED and self.is_selected return is_consume_input end From 6f4bce288221d3419bc86bf70902a5f00871872a Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Tue, 27 Feb 2024 12:53:52 +0400 Subject: [PATCH 3/9] cleanup --- druid/custom/rich_input/rich_input.lua | 48 +++++++------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index a6c2ca6e..e3c09fd4 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -34,50 +34,29 @@ local SCHEME = { HIGHLIGHT = "highlight_node", } -local function set_cursor(self) - --[[ - if self.input:get_text() == "" then - gui.set_position(self.cursor, vmath.vector3(0, 0, 0)) - self.cursor_letter_index = 0 - return - end - if self.hold_cursor then - local text = self.input:get_text() - local cursor_width = self.text:get_text_size("|")/2 - local gap = self.input.total_width/2 * -1 - local cursor_delta = 0 - cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.cursor_letter_index)) - cursor_width - gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) - self.hold_cursor = false - return - else - gui.set_position(self.cursor, vmath.vector3(self.input.total_width/2, 0, 0)) - end - --]] +local function set_cursor(self) if self.touch_pos_x then local text = self.input:get_text() local node_pos = gui.get_screen_position(self.highlight) local touch_delta_x = self.touch_pos_x - node_pos.x local letters_count = utf8.len(self.input:get_text()) - local cursor_width = self.text:get_text_size("|")/2 local cursor_delta = 0 local gap = self.input.total_width/2 * -1 for i = 1, letters_count do - cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, i)) - cursor_width + cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, i)) - self.half_cursor_width if cursor_delta <= touch_delta_x then gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) self.cursor_letter_index = i end end + self.touch_pos_x = nil else local text = self.input:get_text() - local cursor_width = self.text:get_text_size("|")/2 local gap = self.input.total_width/2 * -1 - local cursor_delta = 0 - cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.cursor_letter_index)) - cursor_width + local cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.cursor_letter_index)) - self.half_cursor_width gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) end end @@ -163,10 +142,6 @@ function RichInput.init(self, template, nodes) self.cursor = self:get_node(SCHEME.CURSOR) self.highlight = self:get_node(SCHEME.HIGHLIGHT) - self.cursor_letter_index = 1 - self.action_pos_x = nil - - --self.input:set_text("") self.placeholder = self.druid:new_text(self:get_node(SCHEME.PLACEHOLDER)) self.text = self.druid:new_text(self:get_node(SCHEME.INPUT)) @@ -178,10 +153,13 @@ function RichInput.init(self, template, nodes) self.input.button.on_double_click:subscribe(on_button_double_click, self) self.input.style.NO_CONSUME_INPUT_WHILE_SELECTED = true self.input.style.SKIP_INPUT_KEYS = true + + self.cursor_letter_index = 1 + self.action_pos_x = nil + self.half_cursor_width = self.text:get_text_size("|")/2 on_unselect(self) clear_text(self) - --update_text(self, "") end @@ -193,6 +171,7 @@ function RichInput.set_placeholder(self, placeholder_text) return self end + function RichInput.on_input(self, action_id, action) self.action_pos_x = action.screen_x @@ -208,26 +187,23 @@ function RichInput.on_input(self, action_id, action) local text = self.input:get_text() local new_text = utf8.sub(text, 1, self.cursor_letter_index) .. utf8.sub(text, self.cursor_letter_index +2 ) self.input:set_text(new_text) - update_text(self) end if action_id == const.ACTION_BACKSPACE and action.pressed then local text = self.input:get_text() local new_text = utf8.sub(text, 1, self.cursor_letter_index-1) .. utf8.sub(text, self.cursor_letter_index +1 ) self.cursor_letter_index = self.cursor_letter_index -1 self.input:set_text(new_text) - update_text(self) end if action_id == const.ACTION_TEXT then self.cursor_letter_index = self.cursor_letter_index +1 - update_text(self) end - + + update_text(self) self.touch_pos_x = nil if utf8.len(self.input:get_text()) <=0 then self.cursor_letter_index = 1 - end - + end end return true end From 7ceae08410910f1e4f1c90b9fdc834352fc9ef96 Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Wed, 13 Mar 2024 11:53:15 +0400 Subject: [PATCH 4/9] light refactor and cleanup --- druid/const.lua | 3 +++ druid/custom/rich_input/rich_input.lua | 33 +++++++++++++++++++------- druid/extended/input.lua | 3 ++- input/game.input_binding | 8 +++++++ 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/druid/const.lua b/druid/const.lua index 3b08a6c4..8c9e04d1 100755 --- a/druid/const.lua +++ b/druid/const.lua @@ -18,6 +18,9 @@ M.ACTION_BACKSPACE = hash(sys.get_config("druid.input_key_backspace", "key_backs M.ACTION_DEL = hash(sys.get_config("druid.input_key_del", "key_del")) M.ACTION_SCROLL_UP = hash(sys.get_config("druid.input_scroll_up", "mouse_wheel_up")) M.ACTION_SCROLL_DOWN = hash(sys.get_config("druid.input_scroll_down", "mouse_wheel_down")) +M.ACTION_LEFT = hash(sys.get_config("druid.input_key_left", "key_left")) +M.ACTION_RIGHT = hash(sys.get_config("druid.input_key_right", "key_right")) + M.IS_STENCIL_CHECK = not (sys.get_config("druid.no_stencil_check") == "1") diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index e3c09fd4..1da7cc66 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -99,7 +99,7 @@ end local function on_select(self) - self.cursor_letter_index = utf8.len(self.input:get_text()) + self.cursor_letter_index = utf8.len(self.input:get_text()) or 0 gui.set_enabled(self.cursor, true) gui.set_enabled(self.highlight, false) gui.set_enabled(self.placeholder.node, false) @@ -154,7 +154,7 @@ function RichInput.init(self, template, nodes) self.input.style.NO_CONSUME_INPUT_WHILE_SELECTED = true self.input.style.SKIP_INPUT_KEYS = true - self.cursor_letter_index = 1 + self.cursor_letter_index = 0 self.action_pos_x = nil self.half_cursor_width = self.text:get_text_size("|")/2 @@ -187,22 +187,37 @@ function RichInput.on_input(self, action_id, action) local text = self.input:get_text() local new_text = utf8.sub(text, 1, self.cursor_letter_index) .. utf8.sub(text, self.cursor_letter_index +2 ) self.input:set_text(new_text) - end + end if action_id == const.ACTION_BACKSPACE and action.pressed then - local text = self.input:get_text() - local new_text = utf8.sub(text, 1, self.cursor_letter_index-1) .. utf8.sub(text, self.cursor_letter_index +1 ) - self.cursor_letter_index = self.cursor_letter_index -1 - self.input:set_text(new_text) + if self.cursor_letter_index > 0 then + local text = self.input:get_text() + local new_text = utf8.sub(text, 1, self.cursor_letter_index-1) .. utf8.sub(text, self.cursor_letter_index +1 ) + self.cursor_letter_index = self.cursor_letter_index -1 + self.input:set_text(new_text) + end end - if action_id == const.ACTION_TEXT then + + if action_id == const.ACTION_TEXT then self.cursor_letter_index = self.cursor_letter_index +1 end + + if action_id == const.ACTION_LEFT and action.pressed then + --print("left") + if self.cursor_letter_index > 1 then + self.cursor_letter_index = self.cursor_letter_index -1 + end + elseif action_id == const.ACTION_RIGHT and action.pressed then + --print("right") + if self.cursor_letter_index < utf8.len(self.input:get_text()) then + self.cursor_letter_index = self.cursor_letter_index + 1 + end + end update_text(self) self.touch_pos_x = nil if utf8.len(self.input:get_text()) <=0 then - self.cursor_letter_index = 1 + self.cursor_letter_index = 0 end end return true diff --git a/druid/extended/input.lua b/druid/extended/input.lua index d4628294..aaa30038 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -142,6 +142,7 @@ function Input.init(self, click_node, text_node, keyboard_type) self.text_height = 0 self.market_text_width = 0 self.total_width = 0 + self.cursor_letter_index = 0 self.max_length = nil self.allowed_characters = nil @@ -183,7 +184,7 @@ function Input.on_input(self, action_id, action) -- ignore arrow keys if not utf8.match(hex, "EF9C8[0-3]") then if not self.allowed_characters or utf8.match(action.text, self.allowed_characters) then - input_text = self.value .. action.text + input_text = self.value .. action.text --<< if self.max_length then input_text = utf8.sub(input_text, 1, self.max_length) end diff --git a/input/game.input_binding b/input/game.input_binding index afafb146..5c52a254 100644 --- a/input/game.input_binding +++ b/input/game.input_binding @@ -34,6 +34,14 @@ key_trigger { input: KEY_DEL action: "key_del" } +key_trigger { + input: KEY_LEFT + action: "key_left" +} +key_trigger { + input: KEY_RIGHT + action: "key_right" +} mouse_trigger { input: MOUSE_WHEEL_UP action: "mouse_wheel_up" From e67b9b427adca2d98875cea54cfbf2b7099b9c61 Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Wed, 13 Mar 2024 12:10:22 +0400 Subject: [PATCH 5/9] light refactor and cleanup --- druid/custom/rich_input/rich_input.lua | 32 +++++++++++++------------- druid/extended/input.lua | 6 ++++- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index 1da7cc66..79b7f62b 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -48,7 +48,7 @@ local function set_cursor(self) cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, i)) - self.half_cursor_width if cursor_delta <= touch_delta_x then gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) - self.cursor_letter_index = i + self.input.cursor_letter_index = i end end @@ -56,7 +56,7 @@ local function set_cursor(self) else local text = self.input:get_text() local gap = self.input.total_width/2 * -1 - local cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.cursor_letter_index)) - self.half_cursor_width + local cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.input.cursor_letter_index)) - self.half_cursor_width gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) end end @@ -87,10 +87,10 @@ local function clear_text(self, replace_with_symbol) if replace_with_symbol then gui.set_position(self.cursor, vmath.vector3(self.input.total_width/2, 0, 0)) - self.cursor_letter_index = 1 + self.input.cursor_letter_index = 1 else gui.set_position(self.cursor, vmath.vector3(0, 0, 0)) - self.cursor_letter_index = 1 + self.input.cursor_letter_index = 1 end gui.set_enabled(self.highlight, false) @@ -99,7 +99,7 @@ end local function on_select(self) - self.cursor_letter_index = utf8.len(self.input:get_text()) or 0 + self.input.cursor_letter_index = utf8.len(self.input:get_text()) or 0 gui.set_enabled(self.cursor, true) gui.set_enabled(self.highlight, false) gui.set_enabled(self.placeholder.node, false) @@ -154,7 +154,7 @@ function RichInput.init(self, template, nodes) self.input.style.NO_CONSUME_INPUT_WHILE_SELECTED = true self.input.style.SKIP_INPUT_KEYS = true - self.cursor_letter_index = 0 + self.input.cursor_letter_index = 0 self.action_pos_x = nil self.half_cursor_width = self.text:get_text_size("|")/2 @@ -185,31 +185,31 @@ function RichInput.on_input(self, action_id, action) else if action_id == const.ACTION_DEL and action.pressed then local text = self.input:get_text() - local new_text = utf8.sub(text, 1, self.cursor_letter_index) .. utf8.sub(text, self.cursor_letter_index +2 ) + local new_text = utf8.sub(text, 1, self.input.cursor_letter_index) .. utf8.sub(text, self.input.cursor_letter_index +2 ) self.input:set_text(new_text) end if action_id == const.ACTION_BACKSPACE and action.pressed then - if self.cursor_letter_index > 0 then + if self.input.cursor_letter_index > 0 then local text = self.input:get_text() - local new_text = utf8.sub(text, 1, self.cursor_letter_index-1) .. utf8.sub(text, self.cursor_letter_index +1 ) - self.cursor_letter_index = self.cursor_letter_index -1 + local new_text = utf8.sub(text, 1, self.input.cursor_letter_index-1) .. utf8.sub(text, self.input.cursor_letter_index +1 ) + self.input.cursor_letter_index = self.input.cursor_letter_index -1 self.input:set_text(new_text) end end if action_id == const.ACTION_TEXT then - self.cursor_letter_index = self.cursor_letter_index +1 + --self.input.cursor_letter_index = self.input.cursor_letter_index +1 end if action_id == const.ACTION_LEFT and action.pressed then --print("left") - if self.cursor_letter_index > 1 then - self.cursor_letter_index = self.cursor_letter_index -1 + if self.input.cursor_letter_index > 1 then + self.input.cursor_letter_index = self.input.cursor_letter_index -1 end elseif action_id == const.ACTION_RIGHT and action.pressed then --print("right") - if self.cursor_letter_index < utf8.len(self.input:get_text()) then - self.cursor_letter_index = self.cursor_letter_index + 1 + if self.input.cursor_letter_index < utf8.len(self.input:get_text()) then + self.input.cursor_letter_index = self.input.cursor_letter_index + 1 end end @@ -217,7 +217,7 @@ function RichInput.on_input(self, action_id, action) self.touch_pos_x = nil if utf8.len(self.input:get_text()) <=0 then - self.cursor_letter_index = 0 + self.input.cursor_letter_index = 0 end end return true diff --git a/druid/extended/input.lua b/druid/extended/input.lua index aaa30038..7b3d4609 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -184,7 +184,11 @@ function Input.on_input(self, action_id, action) -- ignore arrow keys if not utf8.match(hex, "EF9C8[0-3]") then if not self.allowed_characters or utf8.match(action.text, self.allowed_characters) then - input_text = self.value .. action.text --<< + local len = utf8.len(self.value) + local prefix = utf8.sub(self.value, 1, self.cursor_letter_index) + local postfix = utf8.sub(self.value, self.cursor_letter_index+1, (len-self.cursor_letter_index+1)*-1) + input_text =prefix .. action.text .. postfix --input_text = self.value .. action.text + self.cursor_letter_index = self.cursor_letter_index +1 if self.max_length then input_text = utf8.sub(input_text, 1, self.max_length) end From 2e31d10abd4393e345e6ae1a0e2d3cfed9744f74 Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Wed, 20 Mar 2024 16:59:43 +0400 Subject: [PATCH 6/9] other components input blocking fix --- druid/custom/rich_input/rich_input.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index 79b7f62b..0f0a57de 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -47,7 +47,7 @@ local function set_cursor(self) for i = 1, letters_count do cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, i)) - self.half_cursor_width if cursor_delta <= touch_delta_x then - gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) + gui.set_position(self.cursor, vmath.vector3(cursor_delta + self.half_cursor_width/2, 0, 0)) self.input.cursor_letter_index = i end end @@ -57,7 +57,7 @@ local function set_cursor(self) local text = self.input:get_text() local gap = self.input.total_width/2 * -1 local cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.input.cursor_letter_index)) - self.half_cursor_width - gui.set_position(self.cursor, vmath.vector3(cursor_delta, 0, 0)) + gui.set_position(self.cursor, vmath.vector3(cursor_delta + self.half_cursor_width/2, 0, 0)) end end @@ -188,13 +188,14 @@ function RichInput.on_input(self, action_id, action) local new_text = utf8.sub(text, 1, self.input.cursor_letter_index) .. utf8.sub(text, self.input.cursor_letter_index +2 ) self.input:set_text(new_text) end - if action_id == const.ACTION_BACKSPACE and action.pressed then - if self.input.cursor_letter_index > 0 then + if action_id == const.ACTION_BACKSPACE then + if self.input.cursor_letter_index > 0 and gui.is_enabled(self.cursor) and action.pressed then local text = self.input:get_text() local new_text = utf8.sub(text, 1, self.input.cursor_letter_index-1) .. utf8.sub(text, self.input.cursor_letter_index +1 ) self.input.cursor_letter_index = self.input.cursor_letter_index -1 self.input:set_text(new_text) end + return true end if action_id == const.ACTION_TEXT then @@ -220,7 +221,7 @@ function RichInput.on_input(self, action_id, action) self.input.cursor_letter_index = 0 end end - return true + return false end return RichInput From 84471c75cba947f450556e03c0b383b5102ddbfb Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Wed, 20 Mar 2024 17:05:57 +0400 Subject: [PATCH 7/9] text input in the middle of a string fixed, cleanup --- druid/custom/rich_input/rich_input.lua | 10 +++------- druid/extended/input.lua | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index 0f0a57de..06bc3f4a 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -73,7 +73,6 @@ local function update_text(self) local text_width = self.input.total_width local text_height = self.input.text_height animate_cursor(self) - --gui.set_position(self.cursor, vmath.vector3(text_width/2, 0, 0)) gui.set_scale(self.cursor, self.input.text.scale) gui.set_size(self.highlight, vmath.vector3(text_width, text_height, 0)) set_cursor(self) @@ -158,8 +157,8 @@ function RichInput.init(self, template, nodes) self.action_pos_x = nil self.half_cursor_width = self.text:get_text_size("|")/2 - on_unselect(self) - clear_text(self) + on_unselect(self) + clear_text(self) end @@ -188,6 +187,7 @@ function RichInput.on_input(self, action_id, action) local new_text = utf8.sub(text, 1, self.input.cursor_letter_index) .. utf8.sub(text, self.input.cursor_letter_index +2 ) self.input:set_text(new_text) end + if action_id == const.ACTION_BACKSPACE then if self.input.cursor_letter_index > 0 and gui.is_enabled(self.cursor) and action.pressed then local text = self.input:get_text() @@ -198,10 +198,6 @@ function RichInput.on_input(self, action_id, action) return true end - if action_id == const.ACTION_TEXT then - --self.input.cursor_letter_index = self.input.cursor_letter_index +1 - end - if action_id == const.ACTION_LEFT and action.pressed then --print("left") if self.input.cursor_letter_index > 1 then diff --git a/druid/extended/input.lua b/druid/extended/input.lua index 7b3d4609..1401726c 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -186,8 +186,8 @@ function Input.on_input(self, action_id, action) if not self.allowed_characters or utf8.match(action.text, self.allowed_characters) then local len = utf8.len(self.value) local prefix = utf8.sub(self.value, 1, self.cursor_letter_index) - local postfix = utf8.sub(self.value, self.cursor_letter_index+1, (len-self.cursor_letter_index+1)*-1) - input_text =prefix .. action.text .. postfix --input_text = self.value .. action.text + local postfix = utf8.sub(self.value, self.cursor_letter_index+1) + input_text =prefix .. action.text .. postfix self.cursor_letter_index = self.cursor_letter_index +1 if self.max_length then input_text = utf8.sub(input_text, 1, self.max_length) From 68396e1382ff64b68b1e4d5398a7bda61ce8e5b3 Mon Sep 17 00:00:00 2001 From: Dmitriy Pyrin Date: Wed, 20 Mar 2024 17:58:11 +0400 Subject: [PATCH 8/9] cursor unnormal reset fixed --- druid/custom/rich_input/rich_input.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index 06bc3f4a..5a68c77d 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -72,7 +72,6 @@ end local function update_text(self) local text_width = self.input.total_width local text_height = self.input.text_height - animate_cursor(self) gui.set_scale(self.cursor, self.input.text.scale) gui.set_size(self.highlight, vmath.vector3(text_width, text_height, 0)) set_cursor(self) @@ -157,8 +156,8 @@ function RichInput.init(self, template, nodes) self.action_pos_x = nil self.half_cursor_width = self.text:get_text_size("|")/2 - on_unselect(self) clear_text(self) + on_unselect(self) end From f904763a2d9126cf24ecc9108523b1b5fb1ade09 Mon Sep 17 00:00:00 2001 From: sublustris_ru Date: Wed, 3 Apr 2024 11:37:12 +0400 Subject: [PATCH 9/9] non latin symbols fix --- druid/custom/rich_input/rich_input.lua | 5 +- example/example.collection | 360 ------------------------- 2 files changed, 3 insertions(+), 362 deletions(-) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index 5a68c77d..9fec8587 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -45,7 +45,7 @@ local function set_cursor(self) local gap = self.input.total_width/2 * -1 for i = 1, letters_count do - cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, i)) - self.half_cursor_width + cursor_delta = gap + self.text:get_text_size(utf8.sub(text, 1, i)) - self.half_cursor_width if cursor_delta <= touch_delta_x then gui.set_position(self.cursor, vmath.vector3(cursor_delta + self.half_cursor_width/2, 0, 0)) self.input.cursor_letter_index = i @@ -56,7 +56,7 @@ local function set_cursor(self) else local text = self.input:get_text() local gap = self.input.total_width/2 * -1 - local cursor_delta = gap + self.text:get_text_size(string.sub(text, 1, self.input.cursor_letter_index)) - self.half_cursor_width + local cursor_delta = gap + self.text:get_text_size(utf8.sub(text, 1, self.input.cursor_letter_index)) - self.half_cursor_width gui.set_position(self.cursor, vmath.vector3(cursor_delta + self.half_cursor_width/2, 0, 0)) end end @@ -151,6 +151,7 @@ function RichInput.init(self, template, nodes) self.input.button.on_double_click:subscribe(on_button_double_click, self) self.input.style.NO_CONSUME_INPUT_WHILE_SELECTED = true self.input.style.SKIP_INPUT_KEYS = true + self.input.style.IS_LONGTAP_ERASE = false self.input.cursor_letter_index = 0 self.action_pos_x = nil diff --git a/example/example.collection b/example/example.collection index 0d91d8ee..2bf5a015 100644 --- a/example/example.collection +++ b/example/example.collection @@ -133,16 +133,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_overview\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -199,16 +189,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_buttons\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -265,16 +245,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"texts_general\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -331,16 +301,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_sliders\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -397,16 +357,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_grid\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -463,16 +413,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_input\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -529,16 +469,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_scroll\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -595,16 +525,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_data_list\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -661,16 +581,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"data_list_static_grid\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -727,16 +637,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"data_list_dynamic_grid\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -793,16 +693,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"data_list_navigate\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -859,16 +749,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"data_list_add_remove_nodes\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -925,16 +805,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"grid_static_grid\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -991,16 +861,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"grid_animations\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1057,16 +917,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"grid_static_grid_dynamic_pos\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1123,16 +973,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"system_whitelist_blacklist\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1189,16 +1029,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"texts_adjust\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1255,16 +1085,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"system_message_input\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1321,16 +1141,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"custom_rich_input\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1387,16 +1197,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"custom_pin_knob\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1453,16 +1253,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"system_inner_templates\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1519,16 +1309,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_swipe\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1585,16 +1365,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_drag\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1651,16 +1421,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_checkboxes\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1717,16 +1477,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"data_list_reinit_data\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1783,16 +1533,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_layout\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1849,16 +1589,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_hotkey\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1915,16 +1645,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"data_list_with_component\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -1981,16 +1701,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"layout_fit\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -2047,16 +1757,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_progress_bar\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -2113,16 +1813,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"system_late_init_check\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -2179,16 +1869,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"general_hover\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -2245,16 +1925,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"texts_lang_text\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -2311,16 +1981,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"custom_rich_text\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -2377,16 +2037,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"data_list_manage_data\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n" @@ -2443,16 +2093,6 @@ embedded_instances { " z: 0.0\n" " w: 1.0\n" " }\n" - " properties {\n" - " id: \"screen_id\"\n" - " value: \"rich_text_texts\"\n" - " type: PROPERTY_TYPE_HASH\n" - " }\n" - " properties {\n" - " id: \"popup\"\n" - " value: \"true\"\n" - " type: PROPERTY_TYPE_BOOLEAN\n" - " }\n" " property_decls {\n" " }\n" "}\n"