File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 11"""Datastructures for PaginatedDocument."""
22
3+ import copy
34import json
45import logging
56import math
@@ -530,10 +531,16 @@ def get_cells_in_bbox(
530531 """
531532 cells = []
532533 for page_cell in self .iterate_cells (cell_unit ):
533- cell_bbox = page_cell .to_bounding_box ()
534+ pc = copy .deepcopy (page_cell )
535+ # Bring cell_bbox coord origin to the same as input bbox.coord_origin:
536+ if page_cell .rect .coord_origin != bbox .coord_origin :
537+ if bbox .coord_origin == CoordOrigin .TOPLEFT :
538+ pc .rect = pc .rect .to_top_left_origin (self .dimension .height )
539+ elif bbox .coord_origin == CoordOrigin .BOTTOMLEFT :
540+ pc .rect = pc .rect .to_bottom_left_origin (self .dimension .height )
541+ cell_bbox = pc .to_bounding_box ()
534542 if cell_bbox .intersection_over_self (bbox ) > ios :
535- cells .append (page_cell )
536-
543+ cells .append (pc )
537544 return cells
538545
539546 def export_to_dict (self ) -> Dict :
You can’t perform that action at this time.
0 commit comments