enabling draw_arrow again... math is not quite great

This commit is contained in:
Dustin Carlino 2019-01-24 09:58:34 -08:00
parent 5a8e2349e0
commit 9182a57af5
3 changed files with 12 additions and 29 deletions

View File

@ -65,17 +65,16 @@
## Switch to OpenGL (for speed)
- no bugs
- arrows... then debug legend
- do basic benchmarking
- make polygon store points and indices efficiently
- change ezgui API to allow uploading geometry once
- see if performance of huge maps is noticably affected
- undo the y inversion hacks at last!
- need padding around text
- text entry needs to draw the cursor differently
- speed
- make polygon store points and indices efficiently
- change ezgui API to allow uploading geometry once
- measure performance of huge maps
- quality
- need padding around text
- text entry needs to draw the cursor differently
- better arrows (then debug the legend plugin)
- refactoring
- pass canvas to text module, make it do the glyph borrowing?
- pass dims to draw_text_bubble; all callers have it anyway, right?
- probably use f32, not f64 everywhere
- undo the y inversion hacks at last!

View File

@ -47,7 +47,7 @@ impl DrawTurn {
g.draw_polygon(color, &pl.make_polygons(2.0 * BIG_ARROW_THICKNESS));
}
// And a cap on the arrow
g.draw_arrow(color, BIG_ARROW_THICKNESS, &t.geom.last_line());
g.draw_arrow(color, 2.0 * BIG_ARROW_THICKNESS, &t.geom.last_line());
}
pub fn draw_dashed(turn: &Turn, g: &mut GfxCtx, color: Color) {

View File

@ -24,6 +24,7 @@ pub use crate::text::Text;
pub use crate::text_box::TextBox;
pub use crate::top_menu::{Folder, TopMenu};
pub use crate::wizard::{Wizard, WrappedWizard};
use dimensioned::si;
use geom::{Angle, Circle, Line, Polygon, Pt2D, Triangle};
use glium::{implement_vertex, uniform, Surface};
@ -180,23 +181,6 @@ impl<'a> GfxCtx<'a> {
}
pub fn draw_arrow(&mut self, color: Color, thickness: f64, line: &Line) {
self.draw_line(color, thickness, line);
// TODO Raw method doesn't work yet in all cases...
/*graphics::Line::new_round(color.0, thickness).draw_arrow(
[
line.pt1().x(),
line.pt1().y(),
line.pt2().x(),
line.pt2().y(),
],
2.0 * thickness,
&self.ctx.draw_state,
self.ctx.transform,
self.gfx,
);*/
/*use dimensioned::si;
let head_size = 2.0 * thickness;
let angle = line.angle();
let triangle_height = (head_size / 2.0).sqrt() * si::M;
@ -226,7 +210,7 @@ impl<'a> GfxCtx<'a> {
.project_away(head_size, angle.rotate_degs(-135.0)),
line.pt2().project_away(head_size, angle.rotate_degs(135.0)),
]),
);*/
);
}
pub fn draw_polygon(&mut self, color: Color, poly: &Polygon) {