Skip to content

Commit

Permalink
修复样式不能实时生效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liihuu committed Mar 27, 2020
1 parent 7d52b88 commit e51edbb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
26 changes: 12 additions & 14 deletions dist/klinecharts.development.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/klinecharts.development.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/klinecharts.production.min.js

Large diffs are not rendered by default.

26 changes: 12 additions & 14 deletions src/view/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,18 @@ class View {
* @param height
*/
setSize (width, height) {
if (this._width !== width || this._height !== height) {
this._redraw(() => {
const pixelRatio = getPixelRatio(this._ctx)
this._width = width
this._height = height
this._canvas.style.top = '0'
this._canvas.style.width = `${width}px`
this._canvas.style.height = `${height}px`
this._canvas.width = width * pixelRatio
this._canvas.height = height * pixelRatio
this._ctx.scale(pixelRatio, pixelRatio)
// this._ctx.translate(0.5, 0.5)
})
}
this._redraw(() => {
const pixelRatio = getPixelRatio(this._ctx)
this._width = width
this._height = height
this._canvas.style.top = '0'
this._canvas.style.width = `${width}px`
this._canvas.style.height = `${height}px`
this._canvas.width = width * pixelRatio
this._canvas.height = height * pixelRatio
this._ctx.scale(pixelRatio, pixelRatio)
// this._ctx.translate(0.5, 0.5)
})
}

/**
Expand Down

0 comments on commit e51edbb

Please sign in to comment.