1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

[refactor] collect stuff into new mod paint

This commit is contained in:
Emil Ernerfeldt
2020-05-19 22:28:57 +02:00
parent aeaa611005
commit 0f0e385ea3
24 changed files with 212 additions and 190 deletions

View File

@@ -1,4 +1,9 @@
use crate::{layout::Direction, widgets::Label, *};
use crate::{
layout::Direction,
paint::{Outline, PaintCmd, Path, TextStyle},
widgets::Label,
*,
};
#[derive(Clone, Copy, Debug, serde_derive::Deserialize, serde_derive::Serialize)]
#[serde(default)]
@@ -79,7 +84,7 @@ impl State {
}
ui.add_paint_cmd(PaintCmd::Path {
path: mesher::Path::from_point_loop(&points),
path: Path::from_point_loop(&points),
closed: true,
fill_color: None,
outline: Some(Outline::new(stroke_width, stroke_color)),

View File

@@ -1,6 +1,6 @@
//! Frame container
use crate::*;
use crate::{paint::*, *};
#[derive(Clone, Debug, Default)]
pub struct Frame {

View File

@@ -279,7 +279,7 @@ impl Resize {
if self.outline && corner_interact.is_some() {
let rect = Rect::from_min_size(position, state.size);
let rect = rect.expand(2.0); // breathing room for content
ui.add_paint_cmd(PaintCmd::Rect {
ui.add_paint_cmd(paint::PaintCmd::Rect {
rect,
corner_radius: 3.0,
fill_color: None,
@@ -307,7 +307,7 @@ fn paint_resize_corner(ui: &mut Ui, interact: &InteractInfo) {
let mut w = 2.0;
while w < 12.0 {
ui.add_paint_cmd(PaintCmd::line_segment(
ui.add_paint_cmd(paint::PaintCmd::line_segment(
[pos2(corner.x - w, corner.y), pos2(corner.x, corner.y - w)],
color,
width,

View File

@@ -171,14 +171,14 @@ impl ScrollArea {
let handle_fill_color = style.interact(&handle_interact).fill_color;
let handle_outline = style.interact(&handle_interact).rect_outline;
outer_ui.add_paint_cmd(PaintCmd::Rect {
outer_ui.add_paint_cmd(paint::PaintCmd::Rect {
rect: outer_scroll_rect,
corner_radius,
fill_color: Some(outer_ui.style().dark_bg_color),
outline: None,
});
outer_ui.add_paint_cmd(PaintCmd::Rect {
outer_ui.add_paint_cmd(paint::PaintCmd::Rect {
rect: handle_rect.expand(-2.0),
corner_radius,
fill_color: Some(handle_fill_color),