Description:
Add horizontal axis support.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -58,14 +58,21 | |||||
|
58 |
|
58 | ||
|
59 | var tick_spacing = (int)Math.Abs((range.Y - range.X) / points); |
|
59 | var tick_spacing = (int)Math.Abs((range.Y - range.X) / points); |
|
60 | var tick_length = 5; |
|
60 | var tick_length = 5; |
|
61 | var tick_adjust = new Num.Vector2(tick_length, 0); |
|
61 | var tick_adjust = vertical ? new Num.Vector2(tick_length, 0) : new Num.Vector2(0, tick_length); |
|
62 |
|
62 | ||
|
63 | var tick_position = position; |
|
63 | var tick_position = position; |
|
64 |
|
64 | ||
|
65 | for(int i = 0; i < points; i++) { |
|
65 | for(int i = 0; i < points; i++) { |
|
66 | draw_list.AddLine(tick_position, Num.Vector2.Add(tick_position, tick_adjust), 0xFFAAAAAA, 1.0f); |
|
66 | draw_list.AddLine(tick_position, Num.Vector2.Add(tick_position, tick_adjust), 0xFFAAAAAA, 1.0f); |
|
67 |
|
67 | ||
|
68 | tick_position = new Num.Vector2(position.X, position.Y + (i * tick_spacing)); |
|
68 | if (vertical) { |
|
|
69 | tick_position = new Num.Vector2(position.X, position.Y + (i * tick_spacing)); | ||
|
|
70 | } | ||
|
|
71 | else { | ||
|
|
72 | //We increment one, otherwise the first tick is | ||
|
|
73 | tick_position = new Num.Vector2(position.X + ((i + 1) * tick_spacing), position.Y); | ||
|
|
74 | } | ||
|
|
75 | |||
|
69 | } |
|
76 | } |
|
70 |
|
77 | ||
|
71 | } |
|
78 | } |
@@ -273,6 +280,7 | |||||
|
273 | } |
|
280 | } |
|
274 |
|
281 | ||
|
275 | DrawLinearAxis(draw_list, new Num.Vector2(0, 200), true, 10, Num.Vector2.Add(c, new Num.Vector2(padding, padding))); |
|
282 | DrawLinearAxis(draw_list, new Num.Vector2(0, 200), true, 10, Num.Vector2.Add(c, new Num.Vector2(padding, padding))); |
|
|
283 | DrawLinearAxis(draw_list, new Num.Vector2(0, 350), false, 12, Num.Vector2.Add(c, new Num.Vector2(padding, 200 - padding))); | ||
|
276 |
|
284 | ||
|
277 | ImGui.Dummy(new Num.Vector2(350, 200)); |
|
285 | ImGui.Dummy(new Num.Vector2(350, 200)); |
|
278 |
|
286 |
You need to be logged in to leave comments.
Login now