Extract to refreshPDFViewer.

This commit is contained in:
Takashi Tamura 2021-10-06 12:20:17 +09:00
parent b2bb4f2621
commit 81f3d3b31c

View File

@ -242,24 +242,10 @@ class LateXWorkshopPdfViewer implements ILatexWorkshopPdfViewer {
}, 1000)
}
private setupConnectionPort() {
const openPack: ClientRequest = {
type: 'open',
path: this.pdfFilePath,
viewer: (this.embedded ? 'tab' : 'browser')
}
this.send(openPack)
this.connectionPort.onDidReceiveMessage((event: MessageEvent<string>) => {
const data = JSON.parse(event.data) as ServerResponse
switch (data.type) {
case 'synctex': {
this.forwardSynctex(data.data)
break
}
case 'refresh': {
private refreshPDFViewer() {
if (!this.autoReloadEnabled) {
this.addLogMessage('Auto reload temporarily disabled.')
break
return
}
const pack = {
scale: PDFViewerApplication.pdfViewer.currentScaleValue,
@ -294,6 +280,24 @@ class LateXWorkshopPdfViewer implements ILatexWorkshopPdfViewer {
this.onDidRenderPdfFile( () => {
this.send({type:'loaded', path:this.pdfFilePath})
}, {once: true})
}
private setupConnectionPort() {
const openPack: ClientRequest = {
type: 'open',
path: this.pdfFilePath,
viewer: (this.embedded ? 'tab' : 'browser')
}
this.send(openPack)
this.connectionPort.onDidReceiveMessage((event: MessageEvent<string>) => {
const data = JSON.parse(event.data) as ServerResponse
switch (data.type) {
case 'synctex': {
this.forwardSynctex(data.data)
break
}
case 'refresh': {
this.refreshPDFViewer()
break
}
case 'params': {