diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-03-25 15:06:11 +0200 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-03-25 15:06:11 +0200 |
commit | 41e14d35ae2dfa644716cb195545d59c468538c5 (patch) | |
tree | 339bf4dbfd1ac6e66871b7bc2563df6435d335e7 /indra/newview | |
parent | 7bf84bdcbf13084ff3b94590e4061b4a6708b4dc (diff) |
Add keystroke event support and allow adding text lines to the line editor
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/scripts/lua/luafloater_demo.xml | 13 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_luafloater_demo.lua | 4 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_luafloater_gesture_list.lua | 3 | ||||
-rw-r--r-- | indra/newview/scripts/lua/util.lua | 10 |
4 files changed, 15 insertions, 15 deletions
diff --git a/indra/newview/scripts/lua/luafloater_demo.xml b/indra/newview/scripts/lua/luafloater_demo.xml index 069f229128..b2273d7718 100644 --- a/indra/newview/scripts/lua/luafloater_demo.xml +++ b/indra/newview/scripts/lua/luafloater_demo.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater legacy_header_height="18" - height="150" + height="300" layout="topleft" name="lua_demo" title="LUA" @@ -79,4 +79,15 @@ text_color="white" left_delta="15" name="time_lbl"/> + <text_editor + follows="top|left" + font="SansSerif" + height="140" + left="5" + enabled="false" + name="events_editor" + top_pad="15" + word_wrap="true" + max_length="65536" + width="310"/> </floater> diff --git a/indra/newview/scripts/lua/test_luafloater_demo.lua b/indra/newview/scripts/lua/test_luafloater_demo.lua index b81259c060..22ed7d7b3a 100644 --- a/indra/newview/scripts/lua/test_luafloater_demo.lua +++ b/indra/newview/scripts/lua/test_luafloater_demo.lua @@ -2,7 +2,6 @@ XML_FILE_PATH = "luafloater_demo.xml" leap = require 'leap' coro = require 'coro' -util = require 'util' --event pump for sending actions to the floater COMMAND_PUMP_NAME = "" @@ -15,7 +14,7 @@ end) leap.process() local function _event(event_name) - if not util.contains(event_list, event_name) then + if not table.find(event_list, event_name) then print_warning("Incorrect event name: " .. event_name) end return event_name @@ -31,6 +30,7 @@ function getCurrentTime() end function handleEvents(event_data) + post({action="add_text", ctrl_name="events_editor", value = event_data}) if event_data.event == _event("commit") then if event_data.ctrl_name == "disable_ctrl" then post({action="set_enabled", ctrl_name="open_btn", value = (1 - event_data.value)}) diff --git a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua index b46e36b4d9..b1ff129d85 100644 --- a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua +++ b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua @@ -2,7 +2,6 @@ XML_FILE_PATH = "luafloater_gesture_list.xml" leap = require 'leap' coro = require 'coro' -util = require 'util' LLGesture = require 'LLGesture' --event pump for sending actions to the floater @@ -16,7 +15,7 @@ end) leap.process() local function _event(event_name) - if not util.contains(event_list, event_name) then + if not table.find(event_list, event_name) then print_warning("Incorrect event name: " .. event_name) end return event_name diff --git a/indra/newview/scripts/lua/util.lua b/indra/newview/scripts/lua/util.lua index 5d6042dfe5..e3af633ea7 100644 --- a/indra/newview/scripts/lua/util.lua +++ b/indra/newview/scripts/lua/util.lua @@ -36,14 +36,4 @@ function util.equal(t1, t2) return util.empty(temp) end --- check if array-like table contains certain value -function util.contains(t, v) - for _, value in ipairs(t) do - if value == v then - return true - end - end - return false -end - return util |