mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
saveAsPng refactoring
This commit is contained in:
@@ -30,7 +30,6 @@ export default {
|
||||
|
||||
async copyImage (source) {
|
||||
if (source instanceof HTMLCanvasElement) {
|
||||
console.log('canvas')
|
||||
return _copyCanvas(source)
|
||||
} else {
|
||||
return _copyFromDataUrl(source)
|
||||
|
||||
@@ -164,14 +164,13 @@ export default {
|
||||
async saveAsPng () {
|
||||
if (this.viewCustomChart) {
|
||||
this.pivotOptions.rendererOptions.customChartComponent.saveAsPng()
|
||||
} else if (this.viewStandartChart) {
|
||||
const url = await chartHelper.getImageDataUrl(this.$refs.pivotOutput, 'png')
|
||||
this.$emit('loadingImageCompleted')
|
||||
fIo.downloadFromUrl(url, 'pivot')
|
||||
} else {
|
||||
const canvas = await getPivotCanvas(this.$refs.pivotOutput)
|
||||
const source = this.viewStandartChart ?
|
||||
await chartHelper.getImageDataUrl(this.$refs.pivotOutput, 'png') :
|
||||
(await getPivotCanvas(this.$refs.pivotOutput)).toDataURL('image/png')
|
||||
|
||||
this.$emit('loadingImageCompleted')
|
||||
fIo.downloadFromUrl(canvas.toDataURL('image/png'), 'pivot', 'image/png')
|
||||
fIo.downloadFromUrl(source, 'pivot')
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user