Add Edit::cursor_position

This commit is contained in:
Pavel Strakhov 2024-06-08 13:16:28 +01:00 committed by Jeremy Soller
parent 320b034f5b
commit a3a6262e5d
5 changed files with 95 additions and 65 deletions

View file

@ -7,7 +7,7 @@ use cosmic_text::{
use std::{env, fs, num::NonZeroU32, rc::Rc, slice};
use tiny_skia::{Paint, PixmapMut, Rect, Transform};
use winit::{
dpi::PhysicalPosition,
dpi::{PhysicalPosition, PhysicalSize},
event::{ElementState, Event, KeyEvent, MouseButton, MouseScrollDelta, WindowEvent},
event_loop::{ControlFlow, EventLoop},
keyboard::{Key, NamedKey},
@ -130,6 +130,12 @@ fn main() {
None,
);
});
if let Some((x, y)) = editor.cursor_position() {
window.set_ime_cursor_area(
PhysicalPosition::new(x, y),
PhysicalSize::new(20, 20),
);
}
// Draw scrollbar
{