@krainovsd/graph 0.14.0-beta.5 → 0.14.0-beta.7
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/lib/cjs/index.cjs +13 -3
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +7 -2
- package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-area.js +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-area.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-resize.js +5 -1
- package/lib/esm/module/GraphCanvas/slices/init-resize.js.map +1 -1
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -1322,6 +1322,7 @@ function initArea() {
|
|
|
1322
1322
|
if (!this.context)
|
|
1323
1323
|
throw new Error("couldn't create canvas context");
|
|
1324
1324
|
this.context.scale(this.dpi, this.dpi);
|
|
1325
|
+
this.updateRect();
|
|
1325
1326
|
}
|
|
1326
1327
|
}
|
|
1327
1328
|
|
|
@@ -2327,8 +2328,12 @@ function initResize() {
|
|
|
2327
2328
|
signal: abortController.signal,
|
|
2328
2329
|
});
|
|
2329
2330
|
document.addEventListener("visibilitychange", () => {
|
|
2330
|
-
if (
|
|
2331
|
+
if (document.hidden)
|
|
2332
|
+
return;
|
|
2333
|
+
this.updateSize();
|
|
2334
|
+
requestAnimationFrame(() => {
|
|
2331
2335
|
this.updateSize();
|
|
2336
|
+
});
|
|
2332
2337
|
}, { signal: abortController.signal });
|
|
2333
2338
|
observer.observe(this.area);
|
|
2334
2339
|
}
|
|
@@ -3250,8 +3255,13 @@ class GraphCanvas {
|
|
|
3250
3255
|
let localX;
|
|
3251
3256
|
let localY;
|
|
3252
3257
|
if ("offsetX" in event) {
|
|
3253
|
-
localX = event.offsetX;
|
|
3254
|
-
localY = event.offsetY;
|
|
3258
|
+
// localX = event.offsetX;
|
|
3259
|
+
// localY = event.offsetY;
|
|
3260
|
+
const rect = this.areaRect;
|
|
3261
|
+
if (!rect)
|
|
3262
|
+
return [0, 0];
|
|
3263
|
+
localX = event.clientX - rect.left;
|
|
3264
|
+
localY = event.clientY - rect.top;
|
|
3255
3265
|
}
|
|
3256
3266
|
else {
|
|
3257
3267
|
const rect = this.areaRect;
|