var oldLeftUp = window.Tools.PanTool.prototype.mouseLeftUp;
window.Tools.PanTool.prototype.mouseLeftUp = function(e) {
oldLeftUp.call(this, e);
var docViewer = readerControl.docViewer;
var annotationManager = docViewer.GetAnnotationManager();
var mousePoint = {
x: e.pageX,
y: e.pageY
};
readerControl.forEachPageInWrapper(docViewer.GetCurrentPage() - 1, function(pageIndex) {
var pageCoordinate = readerControl.displayMode.WindowToPage(mousePoint, pageIndex);
var annotations = annotationManager.GetAnnotationsList();
for (var i = 0; i < annotations.length; i++) {
var annot = annotations[i];
if (!(annot instanceof Annotations.StickyAnnotation)) {
continue;
}
if (annot.GetPageNumber() - 1 === pageCoordinate.pageIndex) {
var rect = {
x1: annot.GetLeft(),
y1: annot.GetTop(),
x2: annot.GetRight(),
y2: annot.GetBottom()
};
if (pageCoordinate.x >= rect.x1 && pageCoordinate.x <= rect.x2 && pageCoordinate.y >= rect.y1 && pageCoordinate.y <= rect.y2) {
annotationManager.SelectAnnotation(annot);
readerControl.showNotePopup(annot, true);
break;
}
}
}
});
};
var oldLeftDown = window.Tools.PanTool.prototype.mouseLeftDown;
window.Tools.PanTool.prototype.mouseLeftDown = function(e) {
oldLeftDown.call(this, e);
readerControl.annotationManager.DeselectAllAnnotations();
};