lineBBox returns the bounding box for given line
(ln int)
| 157 | |
| 158 | // lineBBox returns the bounding box for given line |
| 159 | func (ed *Editor) lineBBox(ln int) math32.Box2 { |
| 160 | tbb := ed.renderBBox() |
| 161 | var bb math32.Box2 |
| 162 | bb.Min = ed.renderStartPos() |
| 163 | bb.Min.X += ed.LineNumberOffset |
| 164 | bb.Max = bb.Min |
| 165 | bb.Max.Y += ed.lineHeight |
| 166 | bb.Max.X = float32(tbb.Max.X) |
| 167 | if ln >= len(ed.offsets) { |
| 168 | if len(ed.offsets) > 0 { |
| 169 | ln = len(ed.offsets) - 1 |
| 170 | } else { |
| 171 | return bb |
| 172 | } |
| 173 | } else { |
| 174 | bb.Min.Y += ed.offsets[ln] |
| 175 | bb.Max.Y += ed.offsets[ln] |
| 176 | } |
| 177 | if ln >= len(ed.renders) { |
| 178 | return bb |
| 179 | } |
| 180 | rp := &ed.renders[ln] |
| 181 | bb.Max = bb.Min.Add(rp.BBox.Size()) |
| 182 | return bb |
| 183 | } |
| 184 | |
| 185 | // TODO: make viewDepthColors HCT based? |
| 186 |
no test coverage detected