From fc310cf97466545e34331323fd3a47264ae3c83d Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 22 Dec 2020 15:57:50 +0100 Subject: [PATCH] removed hacky caret, fixed highlight rectsize, added voice input idea --- editor/editor-ideas.md | 5 +++++ editor/src/lib.rs | 4 ++-- editor/src/rect.rs | 10 ---------- editor/src/text.rs | 12 +++++------- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/editor/editor-ideas.md b/editor/editor-ideas.md index 09f3c3967b..d1f163b1cf 100644 --- a/editor/editor-ideas.md +++ b/editor/editor-ideas.md @@ -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. * 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. +* 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 diff --git a/editor/src/lib.rs b/editor/src/lib.rs index 6e996b35e2..e02e01de99 100644 --- a/editor/src/lib.rs +++ b/editor/src/lib.rs @@ -107,7 +107,7 @@ fn run_event_loop() -> Result<(), Box> { let mut glyph_brush = build_glyph_brush(&gpu_device, render_format)?; let is_animating = true; - let mut text_state = String::new(); + let mut text_state = "A".to_owned(); let mut keyboard_modifiers = ModifiersState::empty(); // Render loop @@ -341,7 +341,7 @@ fn queue_all_text( position: (30.0, 90.0).into(), area_bounds, 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, ..Default::default() }; diff --git a/editor/src/rect.rs b/editor/src/rect.rs index 97b585ccbc..e243a2289d 100644 --- a/editor/src/rect.rs +++ b/editor/src/rect.rs @@ -1,5 +1,4 @@ use cgmath::Vector2; -use wgpu_glyph::{ab_glyph}; pub struct Rect { pub top_left_coords: Vector2, @@ -7,12 +6,3 @@ pub struct Rect { pub height: f32, 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 - } -} diff --git a/editor/src/text.rs b/editor/src/text.rs index 122f80b2e0..d73a7ff24a 100644 --- a/editor/src/text.rs +++ b/editor/src/text.rs @@ -3,7 +3,7 @@ use ab_glyph::{FontArc, InvalidFont}; 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; #[derive(Debug)] @@ -53,23 +53,21 @@ pub fn queue_text_draw(text: &Text, glyph_brush: &mut GlyphBrush<()>) -> Vec