Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
kaf-lamed-beyt committed Dec 14, 2024
1 parent da13757 commit b27afc4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions crates/image_viewer/src/image_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,18 @@ impl StatusItemView for ImageInfoView {
active_pane_item: Option<&dyn ItemHandle>,
cx: &mut ViewContext<Self>,
) {
// Reset fields
self.width = None;
self.height = None;
self.file_size = None;
self.color_type = None;

// Extract metadata if the item is an ImageItem
if let Some(item) = active_pane_item {
if let Some(image_model) = item.downcast::<Model<ImageItem>>() {
let image_item = image_model.read(cx);

// Assign the properties
self.width = image_item.read(cx).width; // `Option<u32>` is directly assignable
self.height = image_item.read(cx).height; // `Option<u32>` is directly assignable
self.file_size = image_item.read(cx).file_size; // `Option<u64>` is directly assignable

// Handle `color_type`
self.width = image_item.read(cx).width;
self.height = image_item.read(cx).height;
self.file_size = image_item.read(cx).file_size;
self.color_type = image_item.read(cx).color_type;
}
}
Expand Down

0 comments on commit b27afc4

Please sign in to comment.