removed hacky caret, fixed highlight rectsize, added voice input idea

This commit is contained in:
Anton-4 2020-12-22 15:57:50 +01:00
parent c82119e6d8
commit fc310cf974
4 changed files with 12 additions and 19 deletions

View file

@ -70,6 +70,11 @@ These are potentially inspirational resources for the editor's design.
* GPT-3 can generate correct python functions based on a comment describing the functionality, video [here](https://www.youtube.com/watch?v=utuz7wBGjKM). It's possible that training a model using ast's may lead to better results than text based models. * GPT-3 can generate correct python functions based on a comment describing the functionality, video [here](https://www.youtube.com/watch?v=utuz7wBGjKM). It's possible that training a model using ast's may lead to better results than text based models.
* Users with large private code bases could (re)train a publicly available error recovery model to experience benefits without having to share their code. * Users with large private code bases could (re)train a publicly available error recovery model to experience benefits without having to share their code.
* It could be useful to a user who is creating a function to show them the most similar function (type signature, name, comment) in a public+their private database. Say I was using a web framework and I just created a function that has a multipart form as argument, it would be great to have an example instantly available. * It could be useful to a user who is creating a function to show them the most similar function (type signature, name, comment) in a public+their private database. Say I was using a web framework and I just created a function that has a multipart form as argument, it would be great to have an example instantly available.
* Voice input:
* Good for accessibility.
* https://www.youtube.com/watch?v=Ffa3cXM7bjc is interesting for inspiration.
* Describe actions instead of using complicated shortcuts.
* Could be efficient way to communicate with smart assistant.
## General Thoughts/Ideas ## General Thoughts/Ideas

View file

@ -107,7 +107,7 @@ fn run_event_loop() -> Result<(), Box<dyn Error>> {
let mut glyph_brush = build_glyph_brush(&gpu_device, render_format)?; let mut glyph_brush = build_glyph_brush(&gpu_device, render_format)?;
let is_animating = true; let is_animating = true;
let mut text_state = String::new(); let mut text_state = "A".to_owned();
let mut keyboard_modifiers = ModifiersState::empty(); let mut keyboard_modifiers = ModifiersState::empty();
// Render loop // Render loop
@ -341,7 +341,7 @@ fn queue_all_text(
position: (30.0, 90.0).into(), position: (30.0, 90.0).into(),
area_bounds, area_bounds,
color: (0.0, 0.05, 0.46, 1.0).into(), color: (0.0, 0.05, 0.46, 1.0).into(),
text: String::from(format!("{}|", text_state).as_str()), text: String::from(text_state),
size: 40.0, size: 40.0,
..Default::default() ..Default::default()
}; };

View file

@ -1,5 +1,4 @@
use cgmath::Vector2; use cgmath::Vector2;
use wgpu_glyph::{ab_glyph};
pub struct Rect { pub struct Rect {
pub top_left_coords: Vector2<f32>, pub top_left_coords: Vector2<f32>,
@ -7,12 +6,3 @@ pub struct Rect {
pub height: f32, pub height: f32,
pub color: [f32; 3], pub color: [f32; 3],
} }
pub fn convert_rect(glyph_rect: ab_glyph::Rect, color: [f32; 3]) -> Rect {
Rect {
top_left_coords: [glyph_rect.min.x, glyph_rect.min.y].into(),
width: glyph_rect.width(),
height: glyph_rect.height(),
color
}
}

View file

@ -3,7 +3,7 @@
use ab_glyph::{FontArc, InvalidFont}; use ab_glyph::{FontArc, InvalidFont};
use cgmath::{Vector2, Vector4}; use cgmath::{Vector2, Vector4};
use wgpu_glyph::{ab_glyph, GlyphBrush, GlyphBrushBuilder, GlyphCruncher, Section, SectionGlyphIter, SectionGlyph}; use wgpu_glyph::{ab_glyph, GlyphBrush, GlyphBrushBuilder, GlyphCruncher, Section};
use crate::rect::Rect; use crate::rect::Rect;
#[derive(Debug)] #[derive(Debug)]
@ -53,23 +53,21 @@ pub fn queue_text_draw(text: &Text, glyph_brush: &mut GlyphBrush<()>) -> Vec<Rec
let glyph_section_iter = glyph_brush.glyphs_custom_layout(section, &layout); let glyph_section_iter = glyph_brush.glyphs_custom_layout(section, &layout);
let glyph_bound_rects = glyph_section_iter.map(|section_glyph| glyph_section_iter.map(|section_glyph|
{ {
let position = section_glyph.glyph.position; let position = section_glyph.glyph.position;
let px_scale = section_glyph.glyph.scale; let px_scale = section_glyph.glyph.scale;
let width = px_scale.x; let width = px_scale.x * 0.5;
let height = px_scale.y; let height = px_scale.y;
Rect { Rect {
top_left_coords: [position.x - width, position.y - height].into(), top_left_coords: [position.x, position.y - height * 0.75].into(),
width, width,
height, height,
color: [1.0, 1.0, 1.0] color: [1.0, 1.0, 1.0]
} }
} }
).collect(); ).collect()
glyph_bound_rects
} }
pub fn build_glyph_brush( pub fn build_glyph_brush(