1
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d680c57482
commit
197f17fc99
|
|
@ -915,13 +915,7 @@ export default {
|
|||
fullScreenWidth: window.innerWidth - 570 + 'px',
|
||||
fullScreenHeight: window.innerHeight - 130 + 'px',
|
||||
|
||||
ManualsClose: false,
|
||||
screenshotCache: {
|
||||
key: '',
|
||||
at: 0,
|
||||
base64: ''
|
||||
},
|
||||
screenshotInFlight: null
|
||||
ManualsClose: false
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -1066,8 +1060,7 @@ export default {
|
|||
callback()
|
||||
return
|
||||
}
|
||||
const cacheKey = this.getScreenshotCacheKey(measuredData)
|
||||
const base64Str = await this.getOrCaptureScreenshot(cacheKey)
|
||||
const base64Str = await this.captureActiveViewportScreenshot()
|
||||
callback(base64Str)
|
||||
})
|
||||
DicomEvent.$on('imageLocation', async (measuredData) => {
|
||||
|
|
@ -1730,48 +1723,6 @@ export default {
|
|||
}
|
||||
return false
|
||||
},
|
||||
getScreenshotCacheKey(measuredData) {
|
||||
const currentCanvas = this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`] && this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0]
|
||||
const currentStack = currentCanvas && currentCanvas.stack ? currentCanvas.stack : {}
|
||||
return [
|
||||
this.currentDicomCanvasIndex,
|
||||
currentStack.visitTaskId || '',
|
||||
currentStack.seriesId || '',
|
||||
typeof currentStack.currentImageIdIndex === 'number' ? currentStack.currentImageIdIndex : '',
|
||||
measuredData.visitTaskId || '',
|
||||
measuredData.questionId || '',
|
||||
measuredData.rowIndex || '',
|
||||
measuredData.lesionName || '',
|
||||
measuredData.isMarked ? 1 : 0
|
||||
].join('|')
|
||||
},
|
||||
async getOrCaptureScreenshot(cacheKey) {
|
||||
const now = Date.now()
|
||||
if (this.screenshotCache.key === cacheKey &&
|
||||
this.screenshotCache.base64 &&
|
||||
now - this.screenshotCache.at < 1500) {
|
||||
return this.screenshotCache.base64
|
||||
}
|
||||
if (this.screenshotInFlight && this.screenshotInFlight.key === cacheKey) {
|
||||
return this.screenshotInFlight.promise
|
||||
}
|
||||
const promise = this.captureActiveViewportScreenshot()
|
||||
.then((base64) => {
|
||||
this.screenshotCache = {
|
||||
key: cacheKey,
|
||||
at: Date.now(),
|
||||
base64: base64 || ''
|
||||
}
|
||||
return base64
|
||||
})
|
||||
.finally(() => {
|
||||
if (this.screenshotInFlight && this.screenshotInFlight.key === cacheKey) {
|
||||
this.screenshotInFlight = null
|
||||
}
|
||||
})
|
||||
this.screenshotInFlight = { key: cacheKey, promise }
|
||||
return promise
|
||||
},
|
||||
async captureActiveViewportScreenshot() {
|
||||
// const currentCanvas = this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`] && this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0]
|
||||
await this.$nextTick()
|
||||
|
|
|
|||
Loading…
Reference in New Issue