mirror of https://github.com/Leinnan/rpack.git
Layout changes
This commit is contained in:
parent
7fa386c4d7
commit
b2897c8431
66
src/app.rs
66
src/app.rs
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{collections::HashMap, io::Cursor};
|
use std::{collections::HashMap, io::Cursor};
|
||||||
|
|
||||||
use egui::{CollapsingHeader, Color32, DroppedFile, FontFamily, FontId, Image, RichText};
|
use egui::{CollapsingHeader, Color32, DroppedFile, FontFamily, FontId, Image, RichText, Vec2};
|
||||||
use image::DynamicImage;
|
use image::DynamicImage;
|
||||||
|
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
@ -199,8 +199,7 @@ impl TemplateApp {
|
||||||
|
|
||||||
let id = format!("bytes://output_{}.png", self.counter);
|
let id = format!("bytes://output_{}.png", self.counter);
|
||||||
ctx.include_bytes(id.clone(), out_vec.clone());
|
ctx.include_bytes(id.clone(), out_vec.clone());
|
||||||
println!("LENGTH OF {}: {}", id.clone(), out_vec.len());
|
self.image = Some(Image::from_uri(id.clone()).max_size(Vec2::new(256.0,256.0)));
|
||||||
self.image = Some(Image::from_uri(id.clone()));
|
|
||||||
ctx.request_repaint();
|
ctx.request_repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -358,43 +357,42 @@ impl eframe::App for TemplateApp {
|
||||||
ui.add(egui::Label::new(text));
|
ui.add(egui::Label::new(text));
|
||||||
}
|
}
|
||||||
if !self.dropped_files.is_empty() {
|
if !self.dropped_files.is_empty() {
|
||||||
CollapsingHeader::new("Settings")
|
|
||||||
.default_open(false)
|
ui.horizontal_top(|ui|{
|
||||||
.show(ui, |ui| {
|
if let Some(image) = &self.image {
|
||||||
ui.add(
|
ui.add(image.clone());
|
||||||
egui::Slider::new(&mut self.config.max_width, 64..=4096).text("Max width"),
|
}
|
||||||
);
|
CollapsingHeader::new("Settings")
|
||||||
ui.add(
|
.default_open(false)
|
||||||
egui::Slider::new(&mut self.config.max_height, 64..=4096).text("Max height"),
|
.show(ui, |ui| {
|
||||||
);
|
ui.add(
|
||||||
ui.add(
|
egui::Slider::new(&mut self.config.max_width, 64..=4096).text("Width"),
|
||||||
egui::Slider::new(&mut self.config.border_padding, 0..=10).text("border padding"),
|
);
|
||||||
);
|
ui.add(
|
||||||
ui.add(
|
egui::Slider::new(&mut self.config.max_height, 64..=4096).text("Height"),
|
||||||
egui::Slider::new(&mut self.config.texture_padding, 0..=10).text("texture padding"),
|
);
|
||||||
);
|
ui.add(
|
||||||
ui.checkbox(&mut self.config.allow_rotation, "Allow rotation")
|
egui::Slider::new(&mut self.config.border_padding, 0..=10).text("Border Padding"),
|
||||||
.on_hover_text("True to allow rotation of the input images. Default value is `true`. Images rotated will be rotated 90 degrees clockwise.");
|
);
|
||||||
ui.checkbox(&mut self.config.texture_outlines, "Texture outlines")
|
ui.add(
|
||||||
.on_hover_text("True to draw the red line on the edge of the each frames. Useful for debugging.");
|
egui::Slider::new(&mut self.config.texture_padding, 0..=10).text("Texture Padding"),
|
||||||
ui.checkbox(&mut self.config.trim, "Trim").on_hover_text("True to trim the empty pixels of the input images.");
|
);
|
||||||
});
|
ui.checkbox(&mut self.config.allow_rotation, "Allow Rotation")
|
||||||
|
.on_hover_text("True to allow rotation of the input images. Default value is `true`. Images rotated will be rotated 90 degrees clockwise.");
|
||||||
|
ui.checkbox(&mut self.config.texture_outlines, "Texture Outlines")
|
||||||
|
.on_hover_text("True to draw the red line on the edge of the each frames. Useful for debugging.");
|
||||||
|
ui.checkbox(&mut self.config.trim, "Trim").on_hover_text("True to trim the empty pixels of the input images.");
|
||||||
|
});
|
||||||
|
});
|
||||||
ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui|{
|
ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui|{
|
||||||
|
|
||||||
egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| {
|
egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| {
|
||||||
if let Some(image) = &self.image {
|
if let Some(data) = &self.data {
|
||||||
ui.horizontal_top(|ui|{
|
ui.horizontal_top(|ui|{
|
||||||
let data = &self.data.clone().unwrap();
|
|
||||||
ui.label(format!("{} frames, size: {}x{}",data.frames.len(),data.size.0,data.size.1));
|
ui.label(format!("{} frames, size: {}x{}",data.frames.len(),data.size.0,data.size.1));
|
||||||
});
|
});
|
||||||
CollapsingHeader::new("Preview")
|
ui.label(RichText::new("Frames JSON").strong());
|
||||||
.default_open(true)
|
egui_json_tree::JsonTree::new("simple-tree", &data.frames_json).show(ui);
|
||||||
.show(ui, |ui| {
|
|
||||||
ui.label(RichText::new("Frames JSON").strong());
|
|
||||||
egui_json_tree::JsonTree::new("simple-tree", &self.data.clone().unwrap().frames_json).show(ui);
|
|
||||||
ui.label(RichText::new("Spritesheet").strong());
|
|
||||||
ui.add(image.clone());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
ui.separator();
|
ui.separator();
|
||||||
let mut index_to_remove : Option<usize> = None;
|
let mut index_to_remove : Option<usize> = None;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue