Addition of a bar displaying the name of the image being displayed#3
Addition of a bar displaying the name of the image being displayed#3AlexCreamer wants to merge 10 commits into
Conversation
and not the fie path
pedrocr
left a comment
There was a problem hiding this comment.
Besides the smaller stuff I've pointed out as we've discussed on IRC it would make sense to show the image width and height as well at least.
| .center_justify() | ||
| .line_spacing(10.0) | ||
| .set(ids.lefttext, ui); | ||
| } |
|
|
||
| if let Some(ref f) = file { | ||
| let file_name = Path::new(f).file_name().unwrap(); | ||
| widget::Text::new(file_name.to_str().unwrap()) |
There was a problem hiding this comment.
These unwrap()s need to be handled
| (ids.imgcanvas, widget::Canvas::new().color(color::CHARCOAL).border(0.0)), | ||
| (ids.leftarea, widget::Canvas::new().color(color::CHARCOAL).border(0.0).flow_down(&[ | ||
| (ids.imgcanvas, widget::Canvas::new().color(color::GREY).border(0.0)), | ||
| (ids.footer, widget::Canvas::new().color(color::CHARCOAL).length(75.0).border(0.0)), |
There was a problem hiding this comment.
The footer is probably too tall for just the text. It should be sized to hold 1.5 font heights or something like that.
|
|
||
| // The `WidgetId` for our background and `Image` widgets. | ||
| widget_ids!(struct Ids { background, imgcanvas, dragcanvas, setcanvas, settop, setcont, raw_image, chimper, filenav }); | ||
| widget_ids!(struct Ids { background, imgcanvas, dragcanvas, leftarea, lefttext, footer,setcanvas, settop, setcont, raw_image, chimper, filenav }); |
There was a problem hiding this comment.
lefttext is being used on line 188
| .set(ids.chimper, ui); | ||
| } | ||
|
|
||
| const PAD: Scalar = 20.0; |
There was a problem hiding this comment.
This is just copied from the example and has no meaning in this program. A proper variable name should be used instead.
| .line_spacing(10.0) | ||
| .set(ids.lefttext, ui); | ||
| } | ||
|
|
There was a problem hiding this comment.
This is probably excess white space.
pedrocr
left a comment
There was a problem hiding this comment.
This is still very far from being finished, sorry.
| } | ||
| } | ||
|
|
||
| pub fn get_image_dimensions<'a>(&'a self, path: String, size: usize) -> Option<(usize,usize)>{ |
There was a problem hiding this comment.
Parsing the image all over again just to get the dimensions is just broken.
| }, | ||
| }; | ||
| let imgwidth = decoded.width; | ||
| let imgheight = decoded.height; |
There was a problem hiding this comment.
This won't return the image dimensions, it will return the decoded dimensions that in the case of raws has been downsized.
| (ids.imgcanvas, widget::Canvas::new().color(color::CHARCOAL).border(0.0)), | ||
| (ids.leftarea, widget::Canvas::new().color(color::CHARCOAL).border(0.0).flow_down(&[ | ||
| (ids.imgcanvas, widget::Canvas::new().color(color::GREY).border(0.0)), | ||
| (ids.footer, widget::Canvas::new().color(color::CHARCOAL).length(60.0).border(0.0)), |
There was a problem hiding this comment.
This still needs to be sized to the font size.
| let height_usize = dimensions.1; | ||
|
|
||
| let width = &width_usize.to_string(); | ||
| let height = &height_usize.to_string(); |
There was a problem hiding this comment.
This isn't needed at all. format! can handle the usize directly.
No description provided.