Mercurial > projects > doodle
comparison doodle/dia/grid_layer.d @ 41:f2e4e1d29b98
Bah
author | daveb |
---|---|
date | Tue, 01 Jun 2010 17:21:01 +0930 |
parents | 452915ecd1f4 |
children | 1b4c9ba58673 |
comparison
equal
deleted
inserted
replaced
40:1f97022e5c6d | 41:f2e4e1d29b98 |
---|---|
45 model_cr.setLineWidth(0.5); | 45 model_cr.setLineWidth(0.5); |
46 | 46 |
47 { | 47 { |
48 // vertical grid lines | 48 // vertical grid lines |
49 double x = start(model_damage.min_corner.x, mSpacing); | 49 double x = start(model_damage.min_corner.x, mSpacing); |
50 double y0 = model_damage.min_corner.y; | |
51 double y1 = model_damage.max_corner.y; | |
52 | 50 |
53 for (;;) { | 51 for (;;) { |
54 vline(model_cr, x, y0, y1); | 52 vline(model_cr, x, model_damage.min_corner.y, model_damage.max_corner.y); |
55 | 53 |
56 // Ensure 1 pixel wide FIXME is this naughty? We are sneaking | 54 // Ensure 1 pixel wide FIXME is this naughty? We are sneaking |
57 // through cairo to mix model and pixel coordinates... | 55 // through cairo to mix model and pixel coordinates... |
58 model_cr.save(); { | 56 model_cr.save(); { |
59 model_cr.scale(1.0 / xx, 1.0 / yy); | 57 model_cr.scale(1.0 / xx, 1.0 / yy); |
69 } | 67 } |
70 | 68 |
71 { | 69 { |
72 // horizontal grid lines | 70 // horizontal grid lines |
73 double y = start(model_damage.min_corner.y, mSpacing); | 71 double y = start(model_damage.min_corner.y, mSpacing); |
74 double x0 = model_damage.min_corner.x; | |
75 double x1 = model_damage.max_corner.x; | |
76 | 72 |
77 for (;;) { | 73 for (;;) { |
78 hline(model_cr, y, x0, x1); | 74 hline(model_cr, y, model_damage.min_corner.x, model_damage.max_corner.x); |
79 | 75 |
76 // FIXME? | |
80 model_cr.save(); { | 77 model_cr.save(); { |
81 model_cr.scale(1.0 / xx, 1.0 / yy); | 78 model_cr.scale(1.0 / xx, 1.0 / yy); |
82 model_cr.stroke(); | 79 model_cr.stroke(); |
83 } model_cr.restore(); | 80 } model_cr.restore(); |
84 | 81 |
97 override void zoom_changed(double zoom) { | 94 override void zoom_changed(double zoom) { |
98 mZoom = zoom; | 95 mZoom = zoom; |
99 mZoomValid = true; | 96 mZoomValid = true; |
100 | 97 |
101 // FIXME compute spacing properly | 98 // FIXME compute spacing properly |
102 mSpacing = 10.0 / mZoom; // mm | 99 mSpacing = 20.0 / mZoom; // mm |
103 } | 100 } |
104 | 101 |
105 // FIXME use inout parameter? | 102 // FIXME use inout parameter? |
106 override bool snap(in Point a, out Point b) const { | 103 override bool snap(in Point a, out Point b) const { |
107 b = a; | 104 b = a; |