mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 03:17:43 +00:00
Show insertion affordances in tile grids
This commit is contained in:
@@ -25,7 +25,7 @@ use crate::runtime::commands::FireSource;
|
||||
use crate::runtime::env::Label;
|
||||
use crate::style::{ComponentStyle, RuleKind, StyleColor, StyleCx};
|
||||
use craft_behavior::{
|
||||
ColumnKey, ColumnWidth, EditEvent, HitLevel, HitPriority, Intent, ItemLayout as _, ItemSource, Metrics, Mixed, NavShape, PartKey, PointerButton,
|
||||
ColumnKey, ColumnWidth, EditEvent, HitLevel, HitPriority, IconId, Intent, ItemLayout as _, ItemSource, Metrics, Mixed, NavShape, PartKey, PointerButton,
|
||||
PressPhase, Roving, Selection, Sense,
|
||||
};
|
||||
use craft_keymap::{Chord, Key, Mods};
|
||||
@@ -827,6 +827,8 @@ impl<K: Clone + Eq + Hash + Send + Sync + 'static> Component for TileGrid<'_, K>
|
||||
}
|
||||
// The gap under the pointer shows where an insertion lands; the part's state layer shows hover and focus.
|
||||
for &(at, rect) in &self.placed_gaps {
|
||||
let glyph = Rect::from_center_size(rect.center(), Vec2::splat(rect.width().min(rect.height())));
|
||||
ui.draw().icon(glyph, &IconSpec::svg(IconId::new("plus")).color(style.insert));
|
||||
if cx.hover_pos(GAP.at(at as u64)).is_some() {
|
||||
let line = PaintShape::Path(vec![rect.center_top(), rect.center_bottom()]);
|
||||
ui.draw().stroke(&line, StrokeWidth::Thick, style.insert);
|
||||
|
||||
Reference in New Issue
Block a user