@inweb/markup 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.
package/dist/markup.module.js
CHANGED
|
@@ -918,10 +918,12 @@ class KonvaMarkup {
|
|
|
918
918
|
this._konvaTransformer.nodes([]);
|
|
919
919
|
}
|
|
920
920
|
};
|
|
921
|
-
this.
|
|
921
|
+
this.resizeContainer = entries => {
|
|
922
922
|
var _a, _b;
|
|
923
|
-
|
|
924
|
-
(
|
|
923
|
+
const {width: width, height: height} = entries[0].contentRect;
|
|
924
|
+
if (!width || !height) return;
|
|
925
|
+
(_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.width(width);
|
|
926
|
+
(_b = this._konvaStage) === null || _b === void 0 ? void 0 : _b.height(height);
|
|
925
927
|
};
|
|
926
928
|
this.pan = event => {
|
|
927
929
|
const dX = event.dX / window.devicePixelRatio;
|
|
@@ -949,12 +951,12 @@ class KonvaMarkup {
|
|
|
949
951
|
this._markupContainer.style.outline = "0px";
|
|
950
952
|
const parentDiv = this._container.parentElement;
|
|
951
953
|
parentDiv.appendChild(this._markupContainer);
|
|
954
|
+
this._resizeObserver = new ResizeObserver(this.resizeContainer);
|
|
955
|
+
this._resizeObserver.observe(parentDiv);
|
|
952
956
|
this._markupColor.setColor(255, 0, 0);
|
|
953
957
|
this.initializeKonva();
|
|
954
|
-
this.resize();
|
|
955
958
|
if (this._viewer) {
|
|
956
959
|
this._pointerEvents.forEach((x => this._markupContainer.addEventListener(x, this.redirectToViewer)));
|
|
957
|
-
this._viewer.addEventListener("resize", this.resize);
|
|
958
960
|
this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
|
|
959
961
|
this._viewer.addEventListener("pan", this.pan);
|
|
960
962
|
}
|
|
@@ -965,10 +967,11 @@ class KonvaMarkup {
|
|
|
965
967
|
if (this._viewer) {
|
|
966
968
|
this._viewer.removeEventListener("pan", this.pan);
|
|
967
969
|
this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
|
|
968
|
-
this._viewer.removeEventListener("resize", this.resize);
|
|
969
970
|
}
|
|
970
971
|
this._pointerEvents.forEach((x => this._markupContainer.removeEventListener(x, this.redirectToViewer)));
|
|
971
972
|
this.destroyKonva();
|
|
973
|
+
this._resizeObserver.disconnect();
|
|
974
|
+
this._resizeObserver = undefined;
|
|
972
975
|
this._markupContainer.remove();
|
|
973
976
|
this._markupContainer = undefined;
|
|
974
977
|
this._container = undefined;
|