Skip to content

Commit 0ac4d3b

Browse files
committed
fixed(moonegui): name the packages the widgets use, for the stricter check.
Signed-off-by: Leo Cheng (heke1228) <chengkelfan@qq.com>
1 parent 0775a7a commit 0ac4d3b

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

widget/edit.mbt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn edit(
6767
at = cut.1
6868
other = at
6969
}
70-
if input.key_pressed(Backspace) {
70+
if input.key_pressed(@input.Key::Backspace) {
7171
if at != other {
7272
let cut = replace(out, at, other, "")
7373
out = cut.0
@@ -79,7 +79,7 @@ pub fn edit(
7979
}
8080
other = at
8181
}
82-
if input.key_pressed(Delete) {
82+
if input.key_pressed(@input.Key::Delete) {
8383
if at != other {
8484
let cut = replace(out, at, other, "")
8585
out = cut.0
@@ -89,7 +89,7 @@ pub fn edit(
8989
}
9090
other = at
9191
}
92-
match input.key_down(Left) {
92+
match input.key_down(@input.Key::Left) {
9393
Some(mods) => {
9494
at = if at != other && !mods.shift {
9595
smaller(at, other)
@@ -102,7 +102,7 @@ pub fn edit(
102102
}
103103
None => ()
104104
}
105-
match input.key_down(Right) {
105+
match input.key_down(@input.Key::Right) {
106106
Some(mods) => {
107107
at = if at != other && !mods.shift {
108108
larger(at, other)
@@ -115,7 +115,7 @@ pub fn edit(
115115
}
116116
None => ()
117117
}
118-
match input.key_down(Home) {
118+
match input.key_down(@input.Key::Home) {
119119
Some(mods) => {
120120
at = 0
121121
if !mods.shift {
@@ -124,7 +124,7 @@ pub fn edit(
124124
}
125125
None => ()
126126
}
127-
match input.key_down(End) {
127+
match input.key_down(@input.Key::End) {
128128
Some(mods) => {
129129
at = out.length()
130130
if !mods.shift {
@@ -137,7 +137,7 @@ pub fn edit(
137137
}
138138
at = clamp_to(at, out.length())
139139
other = clamp_to(other, out.length())
140-
memory.set(id, Cursor(at~, other~))
140+
memory.set(id, @mem.State::Cursor(at~, other~))
141141
if out != value {
142142
response.mark_changed()
143143
}

widget/slider.mbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ pub fn slider(
4141
if response.enabled && response.focused {
4242
let step = (high - low) / STEPS
4343
let input = ui.ctx().input()
44-
if input.key_pressed(Left) {
44+
if input.key_pressed(@input.Key::Left) {
4545
out = out - step
4646
}
47-
if input.key_pressed(Right) {
47+
if input.key_pressed(@input.Key::Right) {
4848
out = out + step
4949
}
50-
if input.key_pressed(Home) {
50+
if input.key_pressed(@input.Key::Home) {
5151
out = low
5252
}
53-
if input.key_pressed(End) {
53+
if input.key_pressed(@input.Key::End) {
5454
out = high
5555
}
5656
}

widget/widget.mbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn activated(ui : @ctx.Ui, response : @hit.Response) -> Bool {
4949
return false
5050
}
5151
let input = ui.ctx().input()
52-
input.key_pressed(Enter) || input.key_pressed(Space)
52+
input.key_pressed(@input.Key::Enter) || input.key_pressed(@input.Key::Space)
5353
}
5454

5555
///|

0 commit comments

Comments
 (0)