File tree 1 file changed +16
-6
lines changed
1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -125,19 +125,29 @@ pub struct AreaInfo {
125
125
}
126
126
127
127
impl AreaInfo {
128
- /// provide the width of the area
129
- pub fn width ( & self ) -> f64 {
128
+ /// provide the width of the area as f64
129
+ pub fn width_f64 ( & self ) -> f64 {
130
130
( self . end_x - self . start_x ) . abs ( )
131
131
}
132
132
133
- /// provide the height of the area
134
- pub fn height ( & self ) -> f64 {
133
+ /// provide the width of the area as i32
134
+ pub fn width ( & self ) -> i32 {
135
+ self . width_f64 ( ) as i32
136
+ }
137
+
138
+ /// provide the height of the area as f64
139
+ pub fn height_f64 ( & self ) -> f64 {
135
140
( self . end_y - self . start_y ) . abs ( )
136
141
}
137
142
143
+ /// provide the width of the area as i32
144
+ pub fn height ( & self ) -> i32 {
145
+ self . height_f64 ( ) as i32
146
+ }
147
+
138
148
/// caculate the real start position
139
- pub fn left_top_point ( & self ) -> ( f64 , f64 ) {
140
- ( self . start_x . min ( self . end_x ) , ( self . start_y . min ( self . end_y ) ) )
149
+ pub fn left_top_point ( & self ) -> ( i32 , i32 ) {
150
+ ( self . start_x . min ( self . end_x ) as i32 , ( self . start_y . min ( self . end_y ) ) as i32 )
141
151
}
142
152
}
143
153
You can’t perform that action at this time.
0 commit comments