This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put this in your `update` to render marks under the cursor to tell if your input is slow | |
let input_pos = ui.ctx().input(|input| input.pointer.latest_pos()); | |
let marks = ui.memory_mut(|mem| { | |
let marks: &mut VecDeque<Pos2> = | |
mem.data.get_temp_mut_or_default(Id::new("dots")); | |
if let Some(pos) = input_pos { | |
if pos == marks.back().cloned().unwrap_or_default() { | |
// Add a small offset if position is repeated | |
marks.push_back(pos + vec2(3.0, 3.0)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn arrange(&self, ui: &mut Ui, state: &mut DashboardState, repulsion_steps: usize, compaction_steps: usize) { | |
if state.block_rect.is_empty() { | |
return; | |
} | |
let original = state.block_rect.clone(); | |
let mut debug_copy = state.block_rect.clone(); | |
let rects = &mut state.block_rect; | |
let keys: Vec<BlockKey> = rects.keys().collect(); | |
let keys = keys.iter().copied(); |
OlderNewer