use of org.rstudio.studio.client.pdfviewer.events.LookupSynctexSourceEvent in project rstudio by rstudio.
the class PdfJsWindow method firePageClickEvent.
private static void firePageClickEvent(PdfJsWindow win, NativeEvent nativeEvent, Element el) {
if (!DomUtils.isCommandClick(nativeEvent))
return;
Element pageEl = el;
while (pageEl != null) {
if (pageEl.getId().matches("^pageContainer([\\d]+)$")) {
break;
}
pageEl = pageEl.getParentElement();
}
if (pageEl == null)
return;
int page = getContainerPageNum(pageEl);
int pageX = nativeEvent.getClientX() + win.getDocument().getScrollLeft() + win.getDocument().getBody().getScrollLeft() - pageEl.getAbsoluteLeft();
int pageY = nativeEvent.getClientY() + win.getDocument().getDocumentElement().getScrollTop() + win.getDocument().getBody().getScrollTop() - pageEl.getAbsoluteTop();
handlers_.fireEvent(new LookupSynctexSourceEvent(new SyncTexCoordinates(page, (int) ((pageX / win.getCurrentScale() / 96) * 72), (int) ((pageY / win.getCurrentScale() / 96) * 72)), true));
}
use of org.rstudio.studio.client.pdfviewer.events.LookupSynctexSourceEvent in project rstudio by rstudio.
the class PdfJsWindow method fireLookupCurrentViewEvent.
private static void fireLookupCurrentViewEvent(PdfJsWindow win) {
SyncTexCoordinates coords = getBoundaryCoordinates(win, true);
handlers_.fireEvent(new LookupSynctexSourceEvent(coords, false));
}
Aggregations