mouseable views - correction
This commit is contained in:
@@ -68,7 +68,7 @@ function boxdialog:init(name, bounds, title)
|
||||
if curses.KEY_MOUSE then
|
||||
|
||||
-- set click action
|
||||
self:frame():action_set(ltui.action.ac_on_clicked, function (v, x, y)
|
||||
self:frame():action_set(action.ac_on_clicked, function (v, x, y)
|
||||
|
||||
-- return if not mouseable
|
||||
if not v:option("mouseable") then
|
||||
@@ -87,7 +87,7 @@ function boxdialog:init(name, bounds, title)
|
||||
box:bounds():contains(px, py) then
|
||||
|
||||
-- bypass panel
|
||||
return box:action_on(ltui.action.ac_on_clicked, px, py)
|
||||
return box:action_on(action.ac_on_clicked, px, py)
|
||||
end
|
||||
|
||||
-- return true if it doesn't match any selectable view
|
||||
|
@@ -38,11 +38,19 @@ function button:init(name, bounds, text, on_action)
|
||||
-- mark as selectable
|
||||
self:option_set("selectable", true)
|
||||
|
||||
-- show cursor
|
||||
self:cursor_show(true)
|
||||
|
||||
-- init action
|
||||
self:action_set(action.ac_on_enter, on_action)
|
||||
|
||||
if curses.KEY_MOUSE then
|
||||
|
||||
-- mark as mouseable
|
||||
self:option_set("mouseable", true)
|
||||
|
||||
-- set click action
|
||||
self:action_set(ltui.action.ac_on_clicked, function (v)
|
||||
self:action_set(action.ac_on_clicked, function (v)
|
||||
|
||||
-- return if not mouseable
|
||||
if not v:option("mouseable") then
|
||||
@@ -52,14 +60,9 @@ function button:init(name, bounds, text, on_action)
|
||||
if v:parent()._do_select then
|
||||
return v:parent():_do_select()
|
||||
end
|
||||
return v:action_on(ltui.action.ac_on_enter)
|
||||
return v:action_on(action.ac_on_enter)
|
||||
end)
|
||||
|
||||
-- show cursor
|
||||
self:cursor_show(true)
|
||||
|
||||
-- init action
|
||||
self:action_set(action.ac_on_enter, on_action)
|
||||
end
|
||||
end
|
||||
|
||||
-- draw button
|
||||
|
@@ -67,7 +67,7 @@ function panel:init(name, bounds)
|
||||
|
||||
-- try focused first
|
||||
if v:current() and v:current():bounds():contains(x, y) then
|
||||
return v:current():action_on(ltui.action.ac_on_clicked, x, y)
|
||||
return v:current():action_on(action.ac_on_clicked, x, y)
|
||||
end
|
||||
|
||||
local p = v:last()
|
||||
|
Reference in New Issue
Block a user