gridviz 2.0.32 → 2.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gridviz.js +21 -11
- package/dist/gridviz.min.js +1 -1
- package/package.json +1 -1
- package/src/App.js +20 -10
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -663,16 +663,26 @@ export class App {
|
|
|
663
663
|
*/
|
|
664
664
|
defineResizeObserver(container, canvas) {
|
|
665
665
|
// listen to resize events
|
|
666
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
667
|
-
//
|
|
668
|
-
if (
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
666
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
667
|
+
// make sure canvas has been built
|
|
668
|
+
if (container.clientWidth > 0 && container.clientHeight > 0) {
|
|
669
|
+
// make sure we dont exceed loop limit first
|
|
670
|
+
// see: https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded
|
|
671
|
+
window.requestAnimationFrame(() => {
|
|
672
|
+
if (!Array.isArray(entries) || !entries.length) {
|
|
673
|
+
return
|
|
674
|
+
}
|
|
675
|
+
// update the app and canvas size
|
|
676
|
+
if (this.h !== container.clientHeight || this.w !== container.clientWidth) {
|
|
677
|
+
this.h = container.clientHeight
|
|
678
|
+
this.w = container.clientWidth
|
|
679
|
+
this.cg.h = container.clientHeight
|
|
680
|
+
this.cg.w = container.clientWidth
|
|
681
|
+
canvas.setAttribute('width', '' + this.w)
|
|
682
|
+
canvas.setAttribute('height', '' + this.h)
|
|
683
|
+
this.redraw()
|
|
684
|
+
}
|
|
685
|
+
})
|
|
676
686
|
}
|
|
677
687
|
})
|
|
678
688
|
|