allowed copying of 'minimized' image
This commit is contained in:
+15
-4
@@ -31,6 +31,7 @@ pub struct TerrainApp {
|
|||||||
params: GenerationParams,
|
params: GenerationParams,
|
||||||
generation_tab: LeftTab,
|
generation_tab: LeftTab,
|
||||||
preview_focus: PreviewFocus,
|
preview_focus: PreviewFocus,
|
||||||
|
hovered_preview: Option<PreviewFocus>,
|
||||||
textures: Option<TexturePair>,
|
textures: Option<TexturePair>,
|
||||||
generated: Option<GeneratedImages>,
|
generated: Option<GeneratedImages>,
|
||||||
generation_receiver: Option<Receiver<Result<GeneratedImages, String>>>,
|
generation_receiver: Option<Receiver<Result<GeneratedImages, String>>>,
|
||||||
@@ -44,6 +45,7 @@ impl TerrainApp {
|
|||||||
params: GenerationParams::default(),
|
params: GenerationParams::default(),
|
||||||
generation_tab: LeftTab::Generation,
|
generation_tab: LeftTab::Generation,
|
||||||
preview_focus: PreviewFocus::Bumpmap,
|
preview_focus: PreviewFocus::Bumpmap,
|
||||||
|
hovered_preview: None,
|
||||||
textures: None,
|
textures: None,
|
||||||
generated: None,
|
generated: None,
|
||||||
generation_receiver: None,
|
generation_receiver: None,
|
||||||
@@ -316,6 +318,9 @@ impl TerrainApp {
|
|||||||
|
|
||||||
let main_response =
|
let main_response =
|
||||||
render_clickable_image(ui, main_texture, Vec2::new(available.x, main_height), true);
|
render_clickable_image(ui, main_texture, Vec2::new(available.x, main_height), true);
|
||||||
|
if main_response.hovered() {
|
||||||
|
self.hovered_preview = Some(self.preview_focus);
|
||||||
|
}
|
||||||
self.preview_context_menu(&main_response, self.preview_focus);
|
self.preview_context_menu(&main_response, self.preview_focus);
|
||||||
self.overlay_copy_button(ui, main_response.rect, self.preview_focus);
|
self.overlay_copy_button(ui, main_response.rect, self.preview_focus);
|
||||||
ui.add_space(8.0);
|
ui.add_space(8.0);
|
||||||
@@ -348,6 +353,9 @@ impl TerrainApp {
|
|||||||
Vec2::new(thumb_width, bottom_strip_height - 32.0),
|
Vec2::new(thumb_width, bottom_strip_height - 32.0),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
if secondary_response.hovered() {
|
||||||
|
self.hovered_preview = Some(secondary_focus);
|
||||||
|
}
|
||||||
self.preview_context_menu(&secondary_response, secondary_focus);
|
self.preview_context_menu(&secondary_response, secondary_focus);
|
||||||
if secondary_response.clicked() {
|
if secondary_response.clicked() {
|
||||||
self.preview_focus = secondary_focus;
|
self.preview_focus = secondary_focus;
|
||||||
@@ -361,6 +369,11 @@ impl TerrainApp {
|
|||||||
|
|
||||||
impl eframe::App for TerrainApp {
|
impl eframe::App for TerrainApp {
|
||||||
fn update(&mut self, ctx: &Context, _frame: &mut eframe::Frame) {
|
fn update(&mut self, ctx: &Context, _frame: &mut eframe::Frame) {
|
||||||
|
self.hovered_preview = None;
|
||||||
|
self.poll_generation(ctx);
|
||||||
|
self.ui_left_panel(ctx);
|
||||||
|
self.ui_right_panel(ctx);
|
||||||
|
|
||||||
let wants_keyboard_input = ctx.wants_keyboard_input();
|
let wants_keyboard_input = ctx.wants_keyboard_input();
|
||||||
let should_copy = ctx.input(|input| {
|
let should_copy = ctx.input(|input| {
|
||||||
!wants_keyboard_input
|
!wants_keyboard_input
|
||||||
@@ -377,11 +390,9 @@ impl eframe::App for TerrainApp {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if should_copy {
|
if should_copy {
|
||||||
self.copy_preview(self.preview_focus);
|
let preview = self.hovered_preview.unwrap_or(self.preview_focus);
|
||||||
|
self.copy_preview(preview);
|
||||||
}
|
}
|
||||||
self.poll_generation(ctx);
|
|
||||||
self.ui_left_panel(ctx);
|
|
||||||
self.ui_right_panel(ctx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user