mirror of
https://github.com/kepler155c/opus
synced 2024-12-26 00:20:26 +00:00
misc
This commit is contained in:
parent
8e9ff9c626
commit
8d3f5329f2
@ -135,11 +135,8 @@ function Manager:init()
|
|||||||
local ch = Input:translate('mouse_drag', button, x, y)
|
local ch = Input:translate('mouse_drag', button, x, y)
|
||||||
if ch and self.target then
|
if ch and self.target then
|
||||||
local event = self:pointToChild(self.target, x, y)
|
local event = self:pointToChild(self.target, x, y)
|
||||||
|
event.type = ch
|
||||||
-- revisit - should send out scroll_up and scroll_down events
|
self:inputEvent(event.element, event)
|
||||||
-- let the element convert them to up / down
|
|
||||||
self:inputEvent(event.element,
|
|
||||||
{ type = ch, button = button, x = event.x, y = event.y })
|
|
||||||
self.currentPage:sync()
|
self.currentPage:sync()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -3026,14 +3023,15 @@ function UI.Form:createForm()
|
|||||||
for _, child in pairs(self) do
|
for _, child in pairs(self) do
|
||||||
if type(child) == 'table' and child.UIElement then
|
if type(child) == 'table' and child.UIElement then
|
||||||
if child.formKey then
|
if child.formKey then
|
||||||
|
child.value = self.values[child.formKey] or ''
|
||||||
|
end
|
||||||
|
if child.formLabel then
|
||||||
child.x = self.labelWidth + self.margin - 1
|
child.x = self.labelWidth + self.margin - 1
|
||||||
child.y = y
|
child.y = y
|
||||||
if not child.width and not child.ex then
|
if not child.width and not child.ex then
|
||||||
child.ex = -self.margin
|
child.ex = -self.margin
|
||||||
end
|
end
|
||||||
child.value = self.values[child.formKey] or ''
|
|
||||||
end
|
|
||||||
if child.formLabel then
|
|
||||||
table.insert(self.children, UI.Text {
|
table.insert(self.children, UI.Text {
|
||||||
x = self.margin,
|
x = self.margin,
|
||||||
y = y,
|
y = y,
|
||||||
@ -3062,7 +3060,7 @@ end
|
|||||||
|
|
||||||
function UI.Form:validateField(field)
|
function UI.Form:validateField(field)
|
||||||
if field.required then
|
if field.required then
|
||||||
if not field.value or #field.value == 0 then
|
if not field.value or #tostring(field.value) == 0 then
|
||||||
return false, 'Field is required'
|
return false, 'Field is required'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -316,28 +316,14 @@ local function getNodeByParts(parts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function fs.unmount(path)
|
function fs.unmount(path)
|
||||||
|
|
||||||
local parts = splitpath(path)
|
local parts = splitpath(path)
|
||||||
local targetName = table.remove(parts, #parts)
|
local targetName = table.remove(parts, #parts)
|
||||||
|
|
||||||
local node = getNodeByParts(parts)
|
local node = getNodeByParts(parts)
|
||||||
|
|
||||||
if not node or not node.nodes[targetName] then
|
if node and node.nodes[targetName] then
|
||||||
error('Invalid node')
|
|
||||||
end
|
|
||||||
|
|
||||||
node.nodes[targetName] = nil
|
|
||||||
--[[
|
|
||||||
-- remove the shadow directories
|
|
||||||
while #parts > 0 do
|
|
||||||
targetName = table.remove(parts, #parts)
|
|
||||||
node = getNodeByParts(parts)
|
|
||||||
if not Util.empty(node.nodes[targetName].nodes) then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
node.nodes[targetName] = nil
|
node.nodes[targetName] = nil
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function fs.registerType(name, fs)
|
function fs.registerType(name, fs)
|
||||||
|
Loading…
Reference in New Issue
Block a user