热键s下载
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2026-05-11 11:17:03 +08:00
parent 10b5bba0dd
commit 2ce14c6d72
1 changed files with 19 additions and 0 deletions

View File

@ -3326,6 +3326,8 @@ export default {
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].resize(true)
} else if (shortcutKeyEnum === 15) {
//
console.log("截图")
this.saveImage()
} else if (shortcutKeyEnum === 16) {
//
this.toggleInvert()
@ -3362,6 +3364,23 @@ export default {
event.preventDefault()
})
},
async saveImage() {
const divForDownloadViewport = document.querySelector(
`div[data-viewport-uid="${this.viewportKey}-${this.activeViewportIndex}"]`
)
let series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series
const canvas = await html2canvas(divForDownloadViewport)
const base64Str = canvas.toDataURL('image/png', 1)
let file = this.convertBase64ToBlob(base64Str)
const a = document.createElement('a')
a.download = `${series.SeriesInstanceUid}.png`
const blobUrl = URL.createObjectURL(file)
a.href = blobUrl
document.body.appendChild(a)
a.click()
a.remove()
URL.revokeObjectURL(blobUrl)
},
//
resetHotkeyList(arr) {
this.hotKeyList = []