mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 07:49:17 +03:00
fixed caret width, calculate code_txt_xy y based on START_TIP
This commit is contained in:
parent
c18f4b2cc0
commit
0889bac220
@ -2,6 +2,8 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::editor::theme::EdTheme;
|
||||
|
||||
use super::resources::strings::START_TIP;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Config {
|
||||
pub code_font_size: f32,
|
||||
@ -18,3 +20,12 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn make_code_txt_xy(&self) -> (f32, f32) {
|
||||
(
|
||||
self.code_font_size,
|
||||
(START_TIP.matches('\n').count() as f32 + 2.0) * self.code_font_size,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
use super::keyboard_input;
|
||||
use super::style::get_code_txt_xy;
|
||||
use crate::editor::mvc::ed_view;
|
||||
use crate::editor::mvc::ed_view::RenderedWgpu;
|
||||
use crate::editor::resources::strings::{HELLO_WORLD, NOTHING_OPENED};
|
||||
@ -66,7 +65,7 @@ fn run_event_loop(project_dir_path_opt: Option<&Path>) -> Result<(), Box<dyn Err
|
||||
let mut event_loop = winit::event_loop::EventLoop::new();
|
||||
|
||||
let window = winit::window::WindowBuilder::new()
|
||||
.with_inner_size(PhysicalSize::new(1200.0, 1000.0))
|
||||
.with_inner_size(PhysicalSize::new(1900.0, 1000.0))
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
|
||||
@ -290,7 +289,7 @@ fn run_event_loop(project_dir_path_opt: Option<&Path>) -> Result<(), Box<dyn Err
|
||||
let rendered_wgpu_res = ed_view::model_to_wgpu(
|
||||
ed_model,
|
||||
&size,
|
||||
get_code_txt_xy(&config).into(),
|
||||
config.make_code_txt_xy().into(),
|
||||
&config,
|
||||
);
|
||||
|
||||
@ -356,7 +355,7 @@ fn run_event_loop(project_dir_path_opt: Option<&Path>) -> Result<(), Box<dyn Err
|
||||
queue_no_file_text(
|
||||
&size,
|
||||
NOTHING_OPENED,
|
||||
get_code_txt_xy(&config).into(),
|
||||
config.make_code_txt_xy().into(),
|
||||
&config,
|
||||
&mut glyph_brush,
|
||||
);
|
||||
|
@ -8,6 +8,5 @@ mod mvc;
|
||||
mod render_ast;
|
||||
mod render_debug;
|
||||
mod resources;
|
||||
mod style;
|
||||
mod theme;
|
||||
mod util;
|
||||
|
@ -1,5 +0,0 @@
|
||||
use crate::editor::config::Config;
|
||||
|
||||
pub fn get_code_txt_xy(config: &Config) -> (f32, f32) {
|
||||
(config.code_font_size, config.code_font_size * 10.00)
|
||||
}
|
@ -113,7 +113,7 @@ pub fn make_caret_rect(
|
||||
Rect {
|
||||
top_left_coords: (caret_x, caret_y).into(),
|
||||
height: glyph_dim_rect.height,
|
||||
width: glyph_dim_rect.width,
|
||||
width: glyph_dim_rect.width / 6.0,
|
||||
color: ui_theme.caret,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user