fix: 解决首次绘制可能出现的canvas尺寸问题
This commit is contained in:
parent
c26ff78fe5
commit
4adce6a615
@ -662,12 +662,10 @@ Component({
|
||||
|
||||
startPaint() {
|
||||
this.initScreenK();
|
||||
|
||||
this.downloadImages(this.properties.palette).then(async (palette) => {
|
||||
const {
|
||||
width,
|
||||
height
|
||||
} = palette;
|
||||
} = this.properties.palette;
|
||||
|
||||
if (!width || !height) {
|
||||
console.error(`You should set width and height correctly for painter, width: ${width}, height: ${height}`);
|
||||
@ -691,7 +689,8 @@ Component({
|
||||
}
|
||||
this.setData({
|
||||
photoStyle: `width:${this.canvasWidthInPx}px;height:${this.canvasHeightInPx}px;`,
|
||||
});
|
||||
}, function () {
|
||||
this.downloadImages(this.properties.palette).then(async palette => {
|
||||
if (!this.photoContext) {
|
||||
this.photoContext = await this.getCanvasContext(this.properties.use2D, 'photo');
|
||||
}
|
||||
@ -706,6 +705,7 @@ Component({
|
||||
});
|
||||
setStringPrototype(this.screenK, this.properties.scaleRatio);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
downloadImages(palette) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user