mirror of
https://github.com/kepler155c/opus
synced 2025-01-12 08:40:26 +00:00
better emits
This commit is contained in:
parent
dd4211745e
commit
743959c1fa
@ -2756,14 +2756,14 @@ function UI.TextEntry:eventHandler(event)
|
|||||||
self.value = input:sub(1, self.pos-1) .. input:sub(self.pos+1)
|
self.value = input:sub(1, self.pos-1) .. input:sub(self.pos+1)
|
||||||
self.pos = self.pos - 1
|
self.pos = self.pos - 1
|
||||||
self:draw()
|
self:draw()
|
||||||
self:emit({ type = 'text_change', text = self.value })
|
self:emit({ type = 'text_change', text = self.value, element = self })
|
||||||
end
|
end
|
||||||
elseif ch == 'delete' then
|
elseif ch == 'delete' then
|
||||||
local input = tostring(self.value)
|
local input = tostring(self.value)
|
||||||
if self.pos < #input then
|
if self.pos < #input then
|
||||||
self.value = input:sub(1, self.pos) .. input:sub(self.pos+2)
|
self.value = input:sub(1, self.pos) .. input:sub(self.pos+2)
|
||||||
self:draw()
|
self:draw()
|
||||||
self:emit({ type = 'text_change', text = self.value })
|
self:emit({ type = 'text_change', text = self.value, element = self })
|
||||||
end
|
end
|
||||||
elseif #ch == 1 then
|
elseif #ch == 1 then
|
||||||
local input = tostring(self.value)
|
local input = tostring(self.value)
|
||||||
@ -2771,7 +2771,7 @@ function UI.TextEntry:eventHandler(event)
|
|||||||
self.value = input:sub(1, self.pos) .. ch .. input:sub(self.pos+1)
|
self.value = input:sub(1, self.pos) .. ch .. input:sub(self.pos+1)
|
||||||
self.pos = self.pos + 1
|
self.pos = self.pos + 1
|
||||||
self:draw()
|
self:draw()
|
||||||
self:emit({ type = 'text_change', text = self.value })
|
self:emit({ type = 'text_change', text = self.value, element = self })
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
@ -2791,7 +2791,7 @@ function UI.TextEntry:eventHandler(event)
|
|||||||
self.pos = self.pos + #text
|
self.pos = self.pos + #text
|
||||||
self:draw()
|
self:draw()
|
||||||
self:updateCursor()
|
self:updateCursor()
|
||||||
self:emit({ type = 'text_change', text = self.value })
|
self:emit({ type = 'text_change', text = self.value, element = self })
|
||||||
return true
|
return true
|
||||||
|
|
||||||
elseif event.type == 'mouse_click' then
|
elseif event.type == 'mouse_click' then
|
||||||
@ -2804,7 +2804,7 @@ function UI.TextEntry:eventHandler(event)
|
|||||||
local input = tostring(self.value)
|
local input = tostring(self.value)
|
||||||
if #input > 0 then
|
if #input > 0 then
|
||||||
self:reset()
|
self:reset()
|
||||||
self:emit({ type = 'text_change', text = self.value })
|
self:emit({ type = 'text_change', text = self.value, element = self })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user