Skip to content

Commit 779e90b

Browse files
authored
Merge pull request #436 from vizzuhq/fix-canvas-clear
fixed canvas clear on browser zoom.
2 parents 94509d3 + 7e20119 commit 779e90b

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Fixed
66

77
- Fixed redraw on browser zoom (bug since 0.9.0).
8+
- Fixed clearing of the canvas before rendering when devicePixelRatio is not 1.
89
- TypeScript definition fixed, measures can contain null values.
910

1011
### Added

src/apps/weblib/ts-api/htmlcanvas.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export class HtmlCanvas implements Plugin {
102102
this._mainCanvas.height = this._cssHeight * this._scaleFactor
103103
this._offscreenCanvas.width = this._cssWidth * this._scaleFactor
104104
this._offscreenCanvas.height = this._cssHeight * this._scaleFactor
105+
this._offscreenContext.setTransform(1, 0, 0, 1, 0, 0)
105106
this._offscreenContext.translate(0.5, 0.5)
106107
this._offscreenContext.scale(this._scaleFactor, this._scaleFactor)
107108
}
@@ -110,12 +111,7 @@ export class HtmlCanvas implements Plugin {
110111
}
111112

112113
frameBegin(): void {
113-
this._offscreenContext.clearRect(
114-
-1,
115-
-1,
116-
this._mainCanvas.width + 1,
117-
this._mainCanvas.height + 1
118-
)
114+
this._offscreenContext.clearRect(-1, -1, this._cssWidth + 2, this._cssHeight + 2)
119115
}
120116

121117
frameEnd(): void {

0 commit comments

Comments
 (0)