mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-07 02:28:54 +08:00
saveAsPng refactoring
This commit is contained in:
@@ -30,7 +30,6 @@ export default {
|
|||||||
|
|
||||||
async copyImage (source) {
|
async copyImage (source) {
|
||||||
if (source instanceof HTMLCanvasElement) {
|
if (source instanceof HTMLCanvasElement) {
|
||||||
console.log('canvas')
|
|
||||||
return _copyCanvas(source)
|
return _copyCanvas(source)
|
||||||
} else {
|
} else {
|
||||||
return _copyFromDataUrl(source)
|
return _copyFromDataUrl(source)
|
||||||
|
|||||||
@@ -164,14 +164,13 @@ export default {
|
|||||||
async saveAsPng () {
|
async saveAsPng () {
|
||||||
if (this.viewCustomChart) {
|
if (this.viewCustomChart) {
|
||||||
this.pivotOptions.rendererOptions.customChartComponent.saveAsPng()
|
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 {
|
} 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')
|
this.$emit('loadingImageCompleted')
|
||||||
fIo.downloadFromUrl(canvas.toDataURL('image/png'), 'pivot', 'image/png')
|
fIo.downloadFromUrl(source, 'pivot')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user