Fix more edgecases
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -116,12 +116,13 @@ impl Tail {
|
|||||||
|
|
||||||
let prev = self.previous(index);
|
let prev = self.previous(index);
|
||||||
|
|
||||||
if self.head == index {
|
if point.x == 0. || point.y == 0. || prev.x == -1. || prev.y == -1. {
|
||||||
|
// Don't have lines that cross the whole screen while using 1D graph
|
||||||
|
// draw_circle(point.x, point.y,THICKNESS, color);
|
||||||
|
} else if self.head == index {
|
||||||
// Draw the head differently
|
// Draw the head differently
|
||||||
draw_circle(point.x, point.y,THICKNESS*2., color);
|
draw_circle(point.x, point.y,THICKNESS*2., color);
|
||||||
} else if point.x == 0. || point.y == 0. || prev.x == -1. || prev.y == -1. {
|
draw_line(point.x, point.y, prev.x, prev.y, THICKNESS, color);
|
||||||
// Don't have lines that cross the whole screen while using 1D graph
|
|
||||||
draw_circle(point.x, point.y,THICKNESS, color);
|
|
||||||
} else if prev == self.points[self.head] {
|
} else if prev == self.points[self.head] {
|
||||||
// Prevent the tail from connecting to the head
|
// Prevent the tail from connecting to the head
|
||||||
draw_circle(point.x, point.y,THICKNESS, color);
|
draw_circle(point.x, point.y,THICKNESS, color);
|
||||||
@@ -148,7 +149,7 @@ async fn main() {
|
|||||||
// Dot params
|
// Dot params
|
||||||
let mut y_displacement = 0.;
|
let mut y_displacement = 0.;
|
||||||
let mut x_displacement = 0.;
|
let mut x_displacement = 0.;
|
||||||
let mut tail = Tail::new(Axis::Two);
|
let mut tail = Tail::new(Axis::One);
|
||||||
|
|
||||||
// Selection box
|
// Selection box
|
||||||
let mut inital_x_pos = 0.;
|
let mut inital_x_pos = 0.;
|
||||||
|
|||||||
Reference in New Issue
Block a user