Fix ToCToU issue with canvas resizing
This could end up in endless resizing&repainting of the markup canvas.
This commit is contained in:
parent
16e85f5498
commit
0ed93fb9b2
10
service.js
10
service.js
@ -885,12 +885,14 @@ class BesService {
|
||||
this.canvasPanel.style.height = `${this.hostElement.scrollHeight}px`
|
||||
const dpr = window.devicePixelRatio
|
||||
const canvasPanelRect = this.canvasPanel.getBoundingClientRect()
|
||||
const newCanvasWidth = Math.round(canvasPanelRect.width * dpr)
|
||||
const newCanvasHeight = Math.round(canvasPanelRect.height * dpr)
|
||||
if (
|
||||
this.canvasPanel.width !== canvasPanelRect.width * dpr ||
|
||||
this.canvasPanel.height !== canvasPanelRect.height * dpr
|
||||
this.canvasPanel.width !== newCanvasWidth ||
|
||||
this.canvasPanel.height !== newCanvasHeight
|
||||
) {
|
||||
this.canvasPanel.width = Math.round(canvasPanelRect.width * dpr)
|
||||
this.canvasPanel.height = Math.round(canvasPanelRect.height * dpr)
|
||||
this.canvasPanel.width = newCanvasWidth
|
||||
this.canvasPanel.height = newCanvasHeight
|
||||
this.repositionAllMarkup()
|
||||
}
|
||||
if (this.isHostElementInline()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user