Decouple caching from layering and simplify everything
This commit is contained in:
parent
4a356cfc16
commit
6d3e1d835e
15 changed files with 896 additions and 1199 deletions
|
|
@ -368,7 +368,7 @@ where
|
|||
|
||||
let text = value.to_string();
|
||||
|
||||
let (cursor, offset) = if let Some(focus) = state
|
||||
let (cursor, offset, is_selecting) = if let Some(focus) = state
|
||||
.is_focused
|
||||
.as_ref()
|
||||
.filter(|focus| focus.is_window_focused)
|
||||
|
|
@ -406,7 +406,7 @@ where
|
|||
None
|
||||
};
|
||||
|
||||
(cursor, offset)
|
||||
(cursor, offset, false)
|
||||
}
|
||||
cursor::State::Selection { start, end } => {
|
||||
let left = start.min(end);
|
||||
|
|
@ -446,11 +446,12 @@ where
|
|||
} else {
|
||||
left_offset
|
||||
},
|
||||
true,
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
(None, 0.0)
|
||||
(None, 0.0, false)
|
||||
};
|
||||
|
||||
let draw = |renderer: &mut Renderer, viewport| {
|
||||
|
|
@ -482,7 +483,7 @@ where
|
|||
);
|
||||
};
|
||||
|
||||
if cursor.is_some() {
|
||||
if is_selecting {
|
||||
renderer
|
||||
.with_layer(text_bounds, |renderer| draw(renderer, *viewport));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue