eraseAt method
Implementation
Future<bool> eraseAt(int pageIndex, Offset devicePoint) async {
attach();
final UPdfEdit? edit = _edit;
if (edit == null) return false;
final UDocPageInfo info = viewer.pageInfo(pageIndex);
final Offset point = devicePointToPdf(info, devicePoint);
final List<UPdfAnnotationInfo> list = await edit.annotations(pageIndex);
for (final UPdfAnnotationInfo annotation in list.reversed) {
if (annotation.rect.inflate(2).contains(point)) {
final bool removed = await edit.removeAnnotation(pageIndex, annotation.objectNumber);
if (removed) {
_undoStack.remove(annotation.objectNumber);
viewer.invalidatePage(pageIndex);
notifyListeners();
}
return removed;
}
}
return false;
}