zoomToRect method

Future<void> zoomToRect(
  1. int pageNumber,
  2. Map<String, double> rect
)

Zooms the viewer to fit the given rectangular area in the specified page.

await controller.zoomToRect(1, {'x1': 10.0, 'y1': 10.0, 'x2': 20.0, 'y2': 20.0});

pageNumber is 1-indexed. The rect must be in page coordinates, with keys x1, y1, x2, and y2.

Implementation

Future<void> zoomToRect(int pageNumber, Map<String, double> rect) {
  return _channel.invokeMethod(Functions.zoomToRect, <String, dynamic>{
    Parameters.pageNumber: pageNumber,
    "x1": rect["x1"],
    "y1": rect["y1"],
    "x2": rect["x2"],
    "y2": rect["y2"]
  });
}