aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/graph.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ui/graph.rs b/src/ui/graph.rs
index 13e8ac9..63e1c43 100644
--- a/src/ui/graph.rs
+++ b/src/ui/graph.rs
@@ -92,7 +92,7 @@ impl canvas::Program<Message, Renderer> for GraphCanvas {
let zcolor = Color::new(0.27, 0.52, 0.53, 1.0);
let lcolor = Color::new(0.49, 0.43, 0.39, 1.0);
let gcolor = Color::new(0.8, 0.14, 0.11, 1.0);
- let step = 10_usize.pow((400.0 / state.scale).log10() as u32);
+ let step = 10_usize.pow((314.1 / state.scale).log10() as u32);
let unitline_whole = Stroke {
width: 1.0,
@@ -189,17 +189,18 @@ impl canvas::Program<Message, Renderer> for GraphCanvas {
}
});
+ let step = (step / 10).max(1);
let mut y1 = self
.func
.lock()
.unwrap()
.eval(Complex::new(rect.x as f64, 0.0), &self.ctx)
.real as f32;
- for x in rect.x as i64..(rect.x + rect.width) as i64 {
+ for x in (rect.x as i64..(rect.x + rect.width) as i64).step_by(step) {
for d in 0..10 {
let d = d as f32 / 10.0;
- let x1 = x as f32 + d;
- let x2 = x as f32 + d + 0.1;
+ let x1 = x as f32 + d * step as f32;
+ let x2 = x as f32 + (d + 0.1) * step as f32;
let y2 = self
.func
.lock()