summaryrefslogtreecommitdiffstats
path: root/packages/svgbob/src/buffer/cell_buffer/span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/svgbob/src/buffer/cell_buffer/span.rs')
-rw-r--r--packages/svgbob/src/buffer/cell_buffer/span.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/svgbob/src/buffer/cell_buffer/span.rs b/packages/svgbob/src/buffer/cell_buffer/span.rs
index fde515e..b584a9f 100644
--- a/packages/svgbob/src/buffer/cell_buffer/span.rs
+++ b/packages/svgbob/src/buffer/cell_buffer/span.rs
@@ -8,7 +8,7 @@ use crate::{
},
fragment,
map::{circle_map, UNICODE_FRAGMENTS},
- Cell, Fragment, Merge, Settings,
+ Cell, Fragment, Merge, Point, Settings,
};
use itertools::Itertools;
use std::{
@@ -79,6 +79,15 @@ impl Span {
this
}
+ fn top_left(&self) -> Cell {
+ let bounds = self.bounds().expect("must have bounds");
+ bounds.0
+ }
+
+ pub fn localize_point(&self, point: Point) -> Point {
+ self.top_left().localize_point(point)
+ }
+
/// returns the top_left most cell which aligns the top most and the left most cell.
pub(crate) fn bounds(&self) -> Option<(Cell, Cell)> {
if let Some((min_y, max_y)) =
@@ -180,6 +189,15 @@ impl Span {
FragmentSpan::new(self.clone(), circle.into());
accepted.push(circle_frag_span);
un_endorsed_span
+ } else if let Some((three_quarters_arc, un_endorsed_span)) =
+ circle_map::endorse_three_quarters_arc_span(&self)
+ {
+ let three_quarters_arc =
+ three_quarters_arc.absolute_position(top_left);
+ let three_quarters_arc_frag_span =
+ FragmentSpan::new(self.clone(), three_quarters_arc.into());
+ accepted.push(three_quarters_arc_frag_span);
+ un_endorsed_span
} else if let Some((half_arc, un_endorsed_span)) =
circle_map::endorse_half_arc_span(&self)
{