Skip to content

Commit 5f1b372

Browse files
author
Eric Wang
committed
move action to setChecked
1 parent 03b1380 commit 5f1b372

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

MasterFramework Dev/Framework/Controls/CheckBox.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ function framework:CheckBox(scale, defaultState, action)
22
local checkbox
33
local dimension = framework:AutoScalingDimension(scale)
44
local radius = framework:AutoScalingDimension(scale / 2)
5-
6-
local checked = defaultState
5+
local checked
76

87
local highlightColor = framework.color.hoverColor
98
local unhighlightedColor = framework.stroke.defaultBorder
@@ -24,7 +23,6 @@ function framework:CheckBox(scale, defaultState, action)
2423
highlightColor = framework.color.hoverColor
2524
if framework.PointIsInRect(x, y, self:Geometry()) then
2625
checkbox:SetChecked(not checked)
27-
action(checkbox, checked)
2826
end
2927
end
3028
),
@@ -37,9 +35,9 @@ function framework:CheckBox(scale, defaultState, action)
3735
checked = newChecked
3836
unhighlightedColor = (checked and framework.color.selectedColor) or framework.stroke.defaultBorder
3937
rect:SetDecorations({ (isInside and highlightColor) or unhighlightedColor })
38+
action(checkbox, checked)
4039
end
4140

42-
checkbox:SetChecked(checked)
43-
action(checkbox, checked)
41+
checkbox:SetChecked(defaultState)
4442
return checkbox
45-
end
43+
end

0 commit comments

Comments
 (0)