@inweb/viewer-visualize 25.7.7 → 25.7.8
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.
|
@@ -1623,10 +1623,12 @@ class KonvaMarkup {
|
|
|
1623
1623
|
this._konvaTransformer.nodes([]);
|
|
1624
1624
|
}
|
|
1625
1625
|
};
|
|
1626
|
-
this.
|
|
1626
|
+
this.resizeContainer = entries => {
|
|
1627
1627
|
var _a, _b;
|
|
1628
|
-
|
|
1629
|
-
(
|
|
1628
|
+
const {width: width, height: height} = entries[0].contentRect;
|
|
1629
|
+
if (!width || !height) return;
|
|
1630
|
+
(_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.width(width);
|
|
1631
|
+
(_b = this._konvaStage) === null || _b === void 0 ? void 0 : _b.height(height);
|
|
1630
1632
|
};
|
|
1631
1633
|
this.pan = event => {
|
|
1632
1634
|
const dX = event.dX / window.devicePixelRatio;
|
|
@@ -1654,12 +1656,12 @@ class KonvaMarkup {
|
|
|
1654
1656
|
this._markupContainer.style.outline = "0px";
|
|
1655
1657
|
const parentDiv = this._container.parentElement;
|
|
1656
1658
|
parentDiv.appendChild(this._markupContainer);
|
|
1659
|
+
this._resizeObserver = new ResizeObserver(this.resizeContainer);
|
|
1660
|
+
this._resizeObserver.observe(parentDiv);
|
|
1657
1661
|
this._markupColor.setColor(255, 0, 0);
|
|
1658
1662
|
this.initializeKonva();
|
|
1659
|
-
this.resize();
|
|
1660
1663
|
if (this._viewer) {
|
|
1661
1664
|
this._pointerEvents.forEach((x => this._markupContainer.addEventListener(x, this.redirectToViewer)));
|
|
1662
|
-
this._viewer.addEventListener("resize", this.resize);
|
|
1663
1665
|
this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
|
|
1664
1666
|
this._viewer.addEventListener("pan", this.pan);
|
|
1665
1667
|
}
|
|
@@ -1670,10 +1672,11 @@ class KonvaMarkup {
|
|
|
1670
1672
|
if (this._viewer) {
|
|
1671
1673
|
this._viewer.removeEventListener("pan", this.pan);
|
|
1672
1674
|
this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
|
|
1673
|
-
this._viewer.removeEventListener("resize", this.resize);
|
|
1674
1675
|
}
|
|
1675
1676
|
this._pointerEvents.forEach((x => this._markupContainer.removeEventListener(x, this.redirectToViewer)));
|
|
1676
1677
|
this.destroyKonva();
|
|
1678
|
+
this._resizeObserver.disconnect();
|
|
1679
|
+
this._resizeObserver = undefined;
|
|
1677
1680
|
this._markupContainer.remove();
|
|
1678
1681
|
this._markupContainer = undefined;
|
|
1679
1682
|
this._container = undefined;
|