mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
rename data to const
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
-- to create your own rich components.
|
||||
-- @module druid
|
||||
|
||||
local data = require("druid.data")
|
||||
local const = require("druid.const")
|
||||
local druid_input = require("druid.helper.druid_input")
|
||||
local settings = require("druid.settings")
|
||||
|
||||
@@ -86,7 +86,7 @@ local function create(self, module)
|
||||
end
|
||||
self[v][#self[v] + 1] = instance
|
||||
|
||||
if data.ui_input[v] then
|
||||
if const.ui_input[v] then
|
||||
input_init(self)
|
||||
end
|
||||
end
|
||||
@@ -130,7 +130,7 @@ end
|
||||
|
||||
--- Called on_message
|
||||
function _fct_metatable.on_message(self, message_id, message, sender)
|
||||
local specific_ui_message = data.specific_ui_messages[message_id]
|
||||
local specific_ui_message = const.specific_ui_messages[message_id]
|
||||
if specific_ui_message then
|
||||
local array = self[message_id]
|
||||
if array then
|
||||
@@ -141,7 +141,7 @@ function _fct_metatable.on_message(self, message_id, message, sender)
|
||||
end
|
||||
end
|
||||
else
|
||||
local array = self[data.ON_MESSAGE]
|
||||
local array = self[const.ON_MESSAGE]
|
||||
if array then
|
||||
for i = 1, #array do
|
||||
array[i]:on_message(message_id, message, sender)
|
||||
@@ -152,10 +152,10 @@ end
|
||||
|
||||
|
||||
local function notify_input_on_swipe(self)
|
||||
if self[data.ON_INPUT] then
|
||||
local len = #self[data.ON_INPUT]
|
||||
if self[const.ON_INPUT] then
|
||||
local len = #self[const.ON_INPUT]
|
||||
for i = len, 1, -1 do
|
||||
local comp = self[data.ON_INPUT][i]
|
||||
local comp = self[const.ON_INPUT][i]
|
||||
if comp.on_swipe then
|
||||
comp:on_swipe()
|
||||
end
|
||||
@@ -179,7 +179,7 @@ end
|
||||
|
||||
--- Called ON_INPUT
|
||||
function _fct_metatable.on_input(self, action_id, action)
|
||||
local array = self[data.ON_SWIPE]
|
||||
local array = self[const.ON_SWIPE]
|
||||
if array then
|
||||
local v, result
|
||||
local len = #array
|
||||
@@ -192,7 +192,7 @@ function _fct_metatable.on_input(self, action_id, action)
|
||||
return true
|
||||
end
|
||||
end
|
||||
array = self[data.ON_INPUT]
|
||||
array = self[const.ON_INPUT]
|
||||
if array then
|
||||
local v
|
||||
local len = #array
|
||||
@@ -210,7 +210,7 @@ end
|
||||
|
||||
--- Called on_update
|
||||
function _fct_metatable.update(self, dt)
|
||||
local array = self[data.ON_UPDATE]
|
||||
local array = self[const.ON_UPDATE]
|
||||
if array then
|
||||
for i = 1, #array do
|
||||
array[i]:update(dt)
|
||||
|
Reference in New Issue
Block a user