Added CursorIcons for resizing columns, rows and 8 cardinal directions
This commit is contained in:
parent
2932c36238
commit
1dee439ab1
7 changed files with 73 additions and 9 deletions
|
@ -18,6 +18,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
|
|||
* Added `Link` and `ui.link` ([#1506](https://github.com/emilk/egui/pull/1506)).
|
||||
* Added triple-click support; triple-clicking a TextEdit field will select the whole paragraph ([#1512](https://github.com/emilk/egui/pull/1512)).
|
||||
* Added `Plot::x_grid_spacer` and `Plot::y_grid_spacer` for custom grid spacing ([#1180](https://github.com/emilk/egui/pull/1180)).
|
||||
* Added `CursorIcon`s for resizing columns, rows, and the eight cardinal directions.
|
||||
|
||||
### Changed 🔧
|
||||
* `ClippedMesh` has been replaced with `ClippedPrimitive` ([#1351](https://github.com/emilk/egui/pull/1351)).
|
||||
|
@ -87,7 +88,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
|
|||
* Replaced Frame's `margin: Vec2` with `margin: Margin`, allowing for different margins on opposing sides ([#1219](https://github.com/emilk/egui/pull/1219)).
|
||||
* Renamed `Plot::custom_label_func` to `Plot::label_formatter` ([#1235](https://github.com/emilk/egui/pull/1235)).
|
||||
* `Areas::layer_id_at` ignores non-interatable layers (i.e. Tooltips) ([#1240](https://github.com/emilk/egui/pull/1240)).
|
||||
* `ScrollArea`:s will not shrink below a certain minimum size, set by `min_scrolled_width/min_scrolled_height` ([1255](https://github.com/emilk/egui/pull/1255)).
|
||||
* `ScrollArea`s will not shrink below a certain minimum size, set by `min_scrolled_width/min_scrolled_height` ([1255](https://github.com/emilk/egui/pull/1255)).
|
||||
* For integrations:
|
||||
* `Output` has now been renamed `PlatformOutput` and `Context::run` now returns the new `FullOutput` ([#1292](https://github.com/emilk/egui/pull/1292)).
|
||||
* `FontImage` has been replaced by `TexturesDelta` (found in `FullOutput`), describing what textures were loaded and freed each frame ([#1110](https://github.com/emilk/egui/pull/1110)).
|
||||
|
@ -209,11 +210,11 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
|
|||
* Change the default monospace font to [Hack](https://github.com/source-foundry/Hack).
|
||||
* Label text will now be centered, right-aligned and/or justified based on the layout of the `Ui` it is in.
|
||||
* `Hyperlink` will now word-wrap just like a `Label`.
|
||||
* All `Ui`:s must now have a finite `max_rect`.
|
||||
* All `Ui`s must now have a finite `max_rect`.
|
||||
* Deprecated: `max_rect_finite`, `available_size_before_wrap_finite` and `available_rect_before_wrap_finite`.
|
||||
* `Painter`/`Fonts`: text layout now expect a color when creating a `Galley`. You may override that color with `Painter::galley_with_color`.
|
||||
* MSRV (Minimum Supported Rust Version) is now `1.54.0`.
|
||||
* By default, `DragValue`:s no longer show a tooltip when hovered. Change with `Style::explanation_tooltips`.
|
||||
* By default, `DragValue`s no longer show a tooltip when hovered. Change with `Style::explanation_tooltips`.
|
||||
* Smaller and nicer color picker.
|
||||
* `ScrollArea` will auto-shrink to content size unless told otherwise using `ScollArea::auto_shrink`.
|
||||
* By default, `Slider`'s `clamp_to_range` is set to true.
|
||||
|
@ -373,7 +374,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
|
|||
|
||||
### Fixed 🐛
|
||||
* Fix [defocus-bug on touch screens](https://github.com/emilk/egui/issues/288).
|
||||
* Fix bug with the layout of wide `DragValue`:s.
|
||||
* Fix bug with the layout of wide `DragValue`s.
|
||||
|
||||
### Removed 🔥
|
||||
* Moved experimental markup language to `egui_demo_lib`
|
||||
|
|
|
@ -635,10 +635,23 @@ fn translate_cursor(cursor_icon: egui::CursorIcon) -> Option<winit::window::Curs
|
|||
egui::CursorIcon::NotAllowed => Some(winit::window::CursorIcon::NotAllowed),
|
||||
egui::CursorIcon::PointingHand => Some(winit::window::CursorIcon::Hand),
|
||||
egui::CursorIcon::Progress => Some(winit::window::CursorIcon::Progress),
|
||||
|
||||
egui::CursorIcon::ResizeHorizontal => Some(winit::window::CursorIcon::EwResize),
|
||||
egui::CursorIcon::ResizeNeSw => Some(winit::window::CursorIcon::NeswResize),
|
||||
egui::CursorIcon::ResizeNwSe => Some(winit::window::CursorIcon::NwseResize),
|
||||
egui::CursorIcon::ResizeVertical => Some(winit::window::CursorIcon::NsResize),
|
||||
|
||||
egui::CursorIcon::ResizeEast => Some(winit::window::CursorIcon::EResize),
|
||||
egui::CursorIcon::ResizeSouthEast => Some(winit::window::CursorIcon::SeResize),
|
||||
egui::CursorIcon::ResizeSouth => Some(winit::window::CursorIcon::SResize),
|
||||
egui::CursorIcon::ResizeSouthWest => Some(winit::window::CursorIcon::SwResize),
|
||||
egui::CursorIcon::ResizeWest => Some(winit::window::CursorIcon::WResize),
|
||||
egui::CursorIcon::ResizeNorthWest => Some(winit::window::CursorIcon::NwResize),
|
||||
egui::CursorIcon::ResizeNorth => Some(winit::window::CursorIcon::NResize),
|
||||
egui::CursorIcon::ResizeNorthEast => Some(winit::window::CursorIcon::NeResize),
|
||||
egui::CursorIcon::ResizeColumn => Some(winit::window::CursorIcon::ColResize),
|
||||
egui::CursorIcon::ResizeRow => Some(winit::window::CursorIcon::RowResize),
|
||||
|
||||
egui::CursorIcon::Text => Some(winit::window::CursorIcon::Text),
|
||||
egui::CursorIcon::VerticalText => Some(winit::window::CursorIcon::VerticalText),
|
||||
egui::CursorIcon::Wait => Some(winit::window::CursorIcon::Wait),
|
||||
|
|
|
@ -227,10 +227,11 @@ pub enum CursorIcon {
|
|||
Grabbing,
|
||||
|
||||
// ------------------------------------
|
||||
// Resizing and scrolling
|
||||
/// Something can be scrolled in any direction (panned).
|
||||
AllScroll,
|
||||
|
||||
// ------------------------------------
|
||||
// Resizing in two directions:
|
||||
/// Horizontal resize `-` to make something wider or more narrow (left to/from right)
|
||||
ResizeHorizontal,
|
||||
/// Diagonal resize `/` (right-up to/from left-down)
|
||||
|
@ -240,6 +241,33 @@ pub enum CursorIcon {
|
|||
/// Vertical resize `|` (up-down or down-up)
|
||||
ResizeVertical,
|
||||
|
||||
// ------------------------------------
|
||||
// Resizing in one direction:
|
||||
/// Resize something rightwards (e.g. when dragging the right-most edge of something)
|
||||
ResizeEast,
|
||||
/// Resize something down and right (e.g. when dragging the bottom-right corner of something)
|
||||
ResizeSouthEast,
|
||||
/// Resize something downwards (e.g. when dragging the bottom edge of something)
|
||||
ResizeSouth,
|
||||
/// Resize something down and left (e.g. when dragging the bottom-left corner of something)
|
||||
ResizeSouthWest,
|
||||
/// Resize something leftwards (e.g. when dragging the left edge of something)
|
||||
ResizeWest,
|
||||
/// Resize something up and left (e.g. when dragging the top-left corner of something)
|
||||
ResizeNorthWest,
|
||||
/// Resize something up (e.g. when dragging the top edge of something)
|
||||
ResizeNorth,
|
||||
/// Resize something up and right (e.g. when dragging the top-right corner of something)
|
||||
ResizeNorthEast,
|
||||
|
||||
// ------------------------------------
|
||||
/// Resize a column
|
||||
ResizeColumn,
|
||||
/// Resize a row
|
||||
ResizeRow,
|
||||
|
||||
// ------------------------------------
|
||||
// Zooming:
|
||||
/// Enhance!
|
||||
ZoomIn,
|
||||
/// Let's get a better overview
|
||||
|
@ -247,7 +275,7 @@ pub enum CursorIcon {
|
|||
}
|
||||
|
||||
impl CursorIcon {
|
||||
pub const ALL: [CursorIcon; 25] = [
|
||||
pub const ALL: [CursorIcon; 35] = [
|
||||
CursorIcon::Default,
|
||||
CursorIcon::None,
|
||||
CursorIcon::ContextMenu,
|
||||
|
@ -271,6 +299,16 @@ impl CursorIcon {
|
|||
CursorIcon::ResizeNeSw,
|
||||
CursorIcon::ResizeNwSe,
|
||||
CursorIcon::ResizeVertical,
|
||||
CursorIcon::ResizeEast,
|
||||
CursorIcon::ResizeSouthEast,
|
||||
CursorIcon::ResizeSouth,
|
||||
CursorIcon::ResizeSouthWest,
|
||||
CursorIcon::ResizeWest,
|
||||
CursorIcon::ResizeNorthWest,
|
||||
CursorIcon::ResizeNorth,
|
||||
CursorIcon::ResizeNorthEast,
|
||||
CursorIcon::ResizeColumn,
|
||||
CursorIcon::ResizeRow,
|
||||
CursorIcon::ZoomIn,
|
||||
CursorIcon::ZoomOut,
|
||||
];
|
||||
|
|
|
@ -346,7 +346,7 @@ impl<'a> Table<'a> {
|
|||
let resize_hover = mouse_over_resize_line && !dragging_something_else;
|
||||
|
||||
if resize_hover || is_resizing {
|
||||
ui.output().cursor_icon = egui::CursorIcon::ResizeHorizontal;
|
||||
ui.output().cursor_icon = egui::CursorIcon::ResizeColumn;
|
||||
}
|
||||
|
||||
let stroke = if is_resizing {
|
||||
|
|
|
@ -250,6 +250,18 @@ fn cursor_web_name(cursor: egui::CursorIcon) -> &'static str {
|
|||
egui::CursorIcon::ResizeNeSw => "nesw-resize",
|
||||
egui::CursorIcon::ResizeNwSe => "nwse-resize",
|
||||
egui::CursorIcon::ResizeVertical => "ns-resize",
|
||||
|
||||
egui::CursorIcon::ResizeEast => "e-resize",
|
||||
egui::CursorIcon::ResizeSouthEast => "se-resize",
|
||||
egui::CursorIcon::ResizeSouth => "s-resize",
|
||||
egui::CursorIcon::ResizeSouthWest => "sw-resize",
|
||||
egui::CursorIcon::ResizeWest => "w-resize",
|
||||
egui::CursorIcon::ResizeNorthWest => "nw-resize",
|
||||
egui::CursorIcon::ResizeNorth => "n-resize",
|
||||
egui::CursorIcon::ResizeNorthEast => "ne-resize",
|
||||
egui::CursorIcon::ResizeColumn => "col-resize",
|
||||
egui::CursorIcon::ResizeRow => "row-resize",
|
||||
|
||||
egui::CursorIcon::Text => "text",
|
||||
egui::CursorIcon::VerticalText => "vertical-text",
|
||||
egui::CursorIcon::Wait => "wait",
|
||||
|
|
|
@ -16,7 +16,7 @@ All notable changes to the epaint crate will be documented in this file.
|
|||
* Renamed `TessellationOptions::anti_alias` to `feathering` ([#1408](https://github.com/emilk/egui/pull/1408)).
|
||||
* Renamed `AlphaImage` to `FontImage` to discourage any other use for it ([#1412](https://github.com/emilk/egui/pull/1412)).
|
||||
* Dark text is darker and more readable on bright backgrounds ([#1412](https://github.com/emilk/egui/pull/1412)).
|
||||
* Fix panic when tessellating a [`Shape::Vec`] containing meshes with differing `TextureId`:s ([#1445](https://github.com/emilk/egui/pull/1445)).
|
||||
* Fix panic when tessellating a [`Shape::Vec`] containing meshes with differing `TextureId`s ([#1445](https://github.com/emilk/egui/pull/1445)).
|
||||
* Added `Shape::galley_with_color` which adds the functionality of `Painter::galley_with_color` into the Shape enum. ([#1461](https://github.com/emilk/egui/pull/1461))
|
||||
* MSRV (Minimum Supported Rust Version) is now `1.60.0` ([#1467](https://github.com/emilk/egui/pull/1467)).
|
||||
* Renamed the feature `convert_bytemuck` to `bytemuck` ([#1467](https://github.com/emilk/egui/pull/1467)).
|
||||
|
|
|
@ -828,7 +828,7 @@ impl From<Hsva> for HsvaGamma {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Cheap and ugly.
|
||||
/// Made for graying out disabled `Ui`:s.
|
||||
/// Made for graying out disabled `Ui`s.
|
||||
pub fn tint_color_towards(color: Color32, target: Color32) -> Color32 {
|
||||
let [mut r, mut g, mut b, mut a] = color.to_array();
|
||||
|
||||
|
|
Loading…
Reference in a new issue