热键s下载
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
10b5bba0dd
commit
2ce14c6d72
|
|
@ -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 = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue