Skip to content

Commit

Permalink
fix: Progress (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyj580231 committed Jul 6, 2023
1 parent 4f3a411 commit 29f62f5
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/Progress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,12 @@ Component({
if (this.ctx) return;
const systemInfo = await my.getSystemInfo();
const { pixelRatio } = systemInfo;
return new Promise<void>((resolve) => {
this.ctx = my.createCanvasContext(`progress-canvas-${this.$id}`);
this.ctx.imageSmoothingEnabled = true;
this.ctx.imageSmoothingQuality = 'high';
my.createSelectorQuery()
.select('.ant-progress')
.boundingClientRect()
.exec((res) => {
const { width } = res[0];
this.setData({
canvasWidth: width * pixelRatio,
});
resolve();
});
const { width } = this.props;
this.ctx = my.createCanvasContext(`progress-canvas-${this.$id}`);
this.ctx.imageSmoothingEnabled = true;
this.ctx.imageSmoothingQuality = 'high';
this.setData({
canvasWidth: width * pixelRatio,
});
},
clearCanvas() {
Expand All @@ -58,7 +50,6 @@ Component({
let curRad = Math.floor((prev / 100) * 360);
const targetRad = Math.floor((this.data.curProgress / 100) * 360);
const direction = curRad < targetRad ? 1 : -1;

const draw = () => {
if (curRad == targetRad) return;
curRad = direction * this.props.speed + curRad;
Expand Down

0 comments on commit 29f62f5

Please sign in to comment.