Search in sources :

Example 1 with LookupSynctexSourceEvent

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));
}
Also used : LookupSynctexSourceEvent(org.rstudio.studio.client.pdfviewer.events.LookupSynctexSourceEvent) DivElement(com.google.gwt.dom.client.DivElement) Element(com.google.gwt.dom.client.Element)

Example 2 with LookupSynctexSourceEvent

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));
}
Also used : LookupSynctexSourceEvent(org.rstudio.studio.client.pdfviewer.events.LookupSynctexSourceEvent)

Aggregations

LookupSynctexSourceEvent (org.rstudio.studio.client.pdfviewer.events.LookupSynctexSourceEvent)2 DivElement (com.google.gwt.dom.client.DivElement)1 Element (com.google.gwt.dom.client.Element)1