fixed layout issue
This commit is contained in:
+25
-6
@@ -3,9 +3,8 @@ use std::thread;
|
|||||||
|
|
||||||
use arboard::{Clipboard, ImageData};
|
use arboard::{Clipboard, ImageData};
|
||||||
use eframe::egui::{
|
use eframe::egui::{
|
||||||
self, Align2, Color32, ColorImage, Context, CornerRadius, DragValue, Event, Frame, Key,
|
self, Align2, Color32, ColorImage, Context, CornerRadius, DragValue, Event, FontId, Frame, Key,
|
||||||
Response, RichText, Sense, Slider, Stroke, StrokeKind, TextureHandle, TextureOptions, Ui,
|
Response, RichText, Sense, Slider, Stroke, StrokeKind, TextureHandle, TextureOptions, Ui, Vec2,
|
||||||
Vec2,
|
|
||||||
};
|
};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
@@ -153,10 +152,30 @@ impl TerrainApp {
|
|||||||
let button_size = Vec2::new(28.0, 28.0);
|
let button_size = Vec2::new(28.0, 28.0);
|
||||||
let button_rect = Align2::RIGHT_TOP
|
let button_rect = Align2::RIGHT_TOP
|
||||||
.align_size_within_rect(button_size, anchor_rect.shrink2(Vec2::new(8.0, 8.0)));
|
.align_size_within_rect(button_size, anchor_rect.shrink2(Vec2::new(8.0, 8.0)));
|
||||||
|
let response = ui.interact(
|
||||||
let response = ui.put(
|
|
||||||
button_rect,
|
button_rect,
|
||||||
egui::Button::new(RichText::new("🗍").size(14.0)),
|
ui.make_persistent_id(("main_copy_button", preview == PreviewFocus::Bumpmap)),
|
||||||
|
Sense::click(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let fill = if response.hovered() {
|
||||||
|
Color32::from_rgba_premultiplied(70, 90, 120, 220)
|
||||||
|
} else {
|
||||||
|
Color32::from_rgba_premultiplied(40, 40, 40, 180)
|
||||||
|
};
|
||||||
|
ui.painter().rect_filled(button_rect, CornerRadius::same(6), fill);
|
||||||
|
ui.painter().rect_stroke(
|
||||||
|
button_rect,
|
||||||
|
CornerRadius::same(6),
|
||||||
|
Stroke::new(1.0, Color32::from_rgba_premultiplied(255, 255, 255, 60)),
|
||||||
|
StrokeKind::Outside,
|
||||||
|
);
|
||||||
|
ui.painter().text(
|
||||||
|
button_rect.center(),
|
||||||
|
Align2::CENTER_CENTER,
|
||||||
|
"🗍",
|
||||||
|
FontId::proportional(14.0),
|
||||||
|
Color32::WHITE,
|
||||||
);
|
);
|
||||||
|
|
||||||
if response.clicked() {
|
if response.clicked() {
|
||||||
|
|||||||
Reference in New Issue
Block a user