edited grapher implementation

- fixed grapher implementation with new gui
- fixed a bug in CgLineEdit where pressing backspace on an empty input would cause a crash
This commit is contained in:
FantasyPvP
2023-11-24 21:53:41 +00:00
parent 24d231585d
commit b28b53418a
4 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ impl CgTextEdit for CgLineEdit {
self.ptr += 1;
}
fn backspace(&mut self) {
if self.ptr >= 0 {
if self.ptr > 0 {
self.ptr -= 1;
self.text.remove(self.ptr);
}
+2 -2
View File
@@ -76,7 +76,7 @@ impl CgComponent for CgContainer<'_> {
#[derive(Debug, Clone)]
pub struct CgTextBox {
title: String,
content: String,
pub content: String,
pub position: Position,
pub dimensions: Dimensions,
outlined: bool,
@@ -85,7 +85,7 @@ pub struct CgTextBox {
impl CgTextBox {
pub fn new(title: String, content: String, position: Position, dimensions: Dimensions, outlined: bool) -> CgTextBox {
CgTextBox { title, content, position, dimensions, outlined, wrap_words: false }
CgTextBox { title, content, position, dimensions, outlined, wrap_words: true }
}
fn render_title(&self, frame: &mut Frame) {