File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -138,10 +138,7 @@ impl Layout {
138
138
139
139
let mut row_i = 0 ;
140
140
let mut col_i = 0 ;
141
- let mut x = 0.0 ;
142
- let mut y = 0.0 ;
143
- let mut w = 1.0 ;
144
- let mut h = 1.0 ;
141
+ let mut physical = Rect :: new ( 0.0 , 0.0 , 1.0 , 1.0 ) ;
145
142
let mut background_color = Rgb :: new ( 0xcc , 0xcc , 0xcc ) ;
146
143
147
144
for entry in & self . physical . 0 {
@@ -150,10 +147,10 @@ impl Layout {
150
147
match i {
151
148
PhysicalKeyEnum :: Meta ( meta) => {
152
149
debug ! ( "Key metadata {:?}" , meta) ;
153
- x += meta. x ;
154
- y -= meta. y ;
155
- w = meta. w . unwrap_or ( w) ;
156
- h = meta. h . unwrap_or ( h) ;
150
+ physical . x += meta. x ;
151
+ physical . y -= meta. y ;
152
+ physical . w = meta. w . unwrap_or ( physical . w ) ;
153
+ physical . h = meta. h . unwrap_or ( physical . h ) ;
157
154
background_color = meta
158
155
. c
159
156
. as_ref ( )
@@ -167,23 +164,23 @@ impl Layout {
167
164
keys. push ( Key :: new (
168
165
self ,
169
166
( row_i as u8 , col_i as u8 ) ,
170
- Rect :: new ( x , y , w , h ) ,
167
+ physical ,
171
168
name. clone ( ) ,
172
169
background_color,
173
170
) ) ;
174
171
175
- x += w;
172
+ physical . x += physical . w ;
176
173
177
- w = 1.0 ;
178
- h = 1.0 ;
174
+ physical . w = 1.0 ;
175
+ physical . h = 1.0 ;
179
176
180
177
col_i += 1 ;
181
178
}
182
179
}
183
180
}
184
181
185
- x = 0.0 ;
186
- y -= 1.0 ;
182
+ physical . x = 0.0 ;
183
+ physical . y -= 1.0 ;
187
184
188
185
col_i = 0 ;
189
186
row_i += 1 ;
Original file line number Diff line number Diff line change 1
- #[ derive( Clone , Debug ) ]
1
+ #[ derive( Copy , Clone , Debug ) ]
2
2
pub struct Rect {
3
3
pub x : f64 ,
4
4
pub y : f64 ,
You can’t perform that action at this time.
0 commit comments