GlyphBoxes implements the plot.GlyphBoxer interface.
(plt *plot.Plot)
| 146 | |
| 147 | // GlyphBoxes implements the plot.GlyphBoxer interface. |
| 148 | func (pts *Line) GlyphBoxes(plt *plot.Plot) []plot.GlyphBox { |
| 149 | r := 0.5 * pts.LineStyle.Width |
| 150 | rect := vg.Rectangle{ |
| 151 | Min: vg.Point{ |
| 152 | X: -r, |
| 153 | Y: -r, |
| 154 | }, |
| 155 | Max: vg.Point{ |
| 156 | X: +r, |
| 157 | Y: +r, |
| 158 | }, |
| 159 | } |
| 160 | |
| 161 | bs := make([]plot.GlyphBox, pts.XYs.Len()) |
| 162 | for i := range bs { |
| 163 | x, y := pts.XY(i) |
| 164 | bs[i] = plot.GlyphBox{ |
| 165 | X: plt.X.Norm(x), |
| 166 | Y: plt.Y.Norm(y), |
| 167 | Rectangle: rect, |
| 168 | } |
| 169 | } |
| 170 | return bs |
| 171 | } |
| 172 | |
| 173 | // Thumbnail returns the thumbnail for the Line, implementing the plot.Thumbnailer interface. |
| 174 | func (pts *Line) Thumbnail(c *draw.Canvas) { |