};
// Prepare to render the current object.
- let chunk = fsm.draw_slice(&context, dbg!((self.y_max - self.y).max(0)));
- dbg!(chunk);
+ let chunk = fsm.draw_slice(&context, (self.y_max - self.y).max(0));
self.y += chunk + self.fsm_style.object_spacing;
context.translate(0.0, xr_to_pt(chunk + self.fsm_style.object_spacing));
}
fn draw(&self, device: &mut dyn Device, ofs: Coord2) {
+ fn overlap(a: &Range<isize>, b: &Range<isize>) -> bool {
+ a.contains(&b.start) || b.contains(&a.start)
+ }
+
use Axis2::*;
let cp = &self.table.cp;
+ let headers = Coord2::from_fn(|a| self.table.headers_width(a));
for (y, yr) in self.table.cp[Y]
.iter()
.copied()
.enumerate()
.filter_map(|(y, yr)| if y % 2 == 1 { Some((y / 2, yr)) } else { None })
{
+ if yr.start >= headers[Y] && !overlap(&yr, &self.ranges[Y]) {
+ continue;
+ }
for (x, xr) in self.table.cp[X]
.iter()
.copied()
.enumerate()
.filter_map(|(x, xr)| if x % 2 == 1 { Some((x / 2, xr)) } else { None })
{
+ if xr.start >= headers[X] && !overlap(&xr, &self.ranges[X]) {
+ continue;
+ }
let cell = self.table.table.get(CellPos { x, y });
// XXX skip if not top-left cell
let rect = cell.rect();
// Figure out the width of the body of the table. Use this to determine
// the base scale.
let body_page = Page::new(output.body, device, 0, &pivot_table.style.look);
- let body_width = body_page.width(Axis2::X);
+ let body_width = body_page.width(Axis2::X).min(device.params().size.x());
let mut scale = if body_width > device.params().size[Axis2::X]
&& pivot_table.style.look.shrink_to_fit[Axis2::X]
&& device.params().can_scale