mirror of
https://github.com/docusealco/docuseal
synced 2026-11-10 23:42:32 -05:00
fix resize warning
This commit is contained in:
1 parent
c3d1503361
commit
a46c42c3a0
3 files changed
+27
-15
No files matched your search
@@ -9,13 +9,17 @@ window.customElements.define('draw-signature', class extends HTMLElement {
|
|||||||
this.pad = new SignaturePad(this.canvas)
|
this.pad = new SignaturePad(this.canvas)
|
||||||
|
|
||||||
this.resizeObserver = new ResizeObserver(() => {
|
this.resizeObserver = new ResizeObserver(() => {
|
||||||
const { width, height } = this.canvas
|
requestAnimationFrame(() => {
|
||||||
|
if (!this.canvas) return
|
||||||
|
|
||||||
this.setCanvasSize()
|
const { width, height } = this.canvas
|
||||||
|
|
||||||
if (this.canvas.width !== width || this.canvas.height !== height) {
|
this.setCanvasSize()
|
||||||
this.redrawCanvas(width, height)
|
|
||||||
}
|
if (this.canvas.width !== width || this.canvas.height !== height) {
|
||||||
|
this.redrawCanvas(width, height)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.resizeObserver.observe(this.canvas.parentNode)
|
this.resizeObserver.observe(this.canvas.parentNode)
|
||||||
|
|||||||
@@ -12,13 +12,17 @@ export default targetable(class extends HTMLElement {
|
|||||||
this.pad = new SignaturePad(this.canvas)
|
this.pad = new SignaturePad(this.canvas)
|
||||||
|
|
||||||
this.resizeObserver = new ResizeObserver(() => {
|
this.resizeObserver = new ResizeObserver(() => {
|
||||||
const { width, height } = this.canvas
|
requestAnimationFrame(() => {
|
||||||
|
if (!this.canvas) return
|
||||||
|
|
||||||
this.setCanvasSize()
|
const { width, height } = this.canvas
|
||||||
|
|
||||||
if (this.canvas.width !== width || this.canvas.height !== height) {
|
this.setCanvasSize()
|
||||||
this.redrawCanvas(width, height)
|
|
||||||
}
|
if (this.canvas.width !== width || this.canvas.height !== height) {
|
||||||
|
this.redrawCanvas(width, height)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.resizeObserver.observe(this.canvas.parentNode)
|
this.resizeObserver.observe(this.canvas.parentNode)
|
||||||
|
|||||||
@@ -474,13 +474,17 @@ export default {
|
|||||||
this.intersectionObserver.observe(this.$refs.canvas)
|
this.intersectionObserver.observe(this.$refs.canvas)
|
||||||
|
|
||||||
this.resizeObserver = new ResizeObserver(() => {
|
this.resizeObserver = new ResizeObserver(() => {
|
||||||
const { width, height } = this.$refs.canvas
|
requestAnimationFrame(() => {
|
||||||
|
if (!this.$refs.canvas) return
|
||||||
|
|
||||||
this.setCanvasSize()
|
const { width, height } = this.$refs.canvas
|
||||||
|
|
||||||
if (this.$refs.canvas.width !== width || this.$refs.canvas.height !== height) {
|
this.setCanvasSize()
|
||||||
this.redrawCanvas(width, height)
|
|
||||||
}
|
if (this.$refs.canvas.width !== width || this.$refs.canvas.height !== height) {
|
||||||
|
this.redrawCanvas(width, height)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.resizeObserver.observe(this.$refs.canvas.parentNode)
|
this.resizeObserver.observe(this.$refs.canvas.parentNode)
|
||||||
|
|||||||
Reference in new issue
Block a user