dockview-react 4.2.4 → 4.2.5

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 4.2.4
3
+ * @version 4.2.5
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -645,9 +645,7 @@
645
645
  function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
646
646
  const buffer = options.buffer;
647
647
  const rect = element.getBoundingClientRect();
648
- const rootRect = element.getBoundingClientRect();
649
- const viewportWidth = root.clientWidth;
650
- const viewportHeight = root.clientHeight;
648
+ const rootRect = root.getBoundingClientRect();
651
649
  let translateX = 0;
652
650
  let translateY = 0;
653
651
  const left = rect.left - rootRect.left;
@@ -658,15 +656,15 @@
658
656
  if (left < buffer) {
659
657
  translateX = buffer - left;
660
658
  }
661
- else if (right > viewportWidth - buffer) {
662
- translateX = viewportWidth - right - buffer;
659
+ else if (right > buffer) {
660
+ translateX = -buffer - right;
663
661
  }
664
662
  // Check vertical overflow
665
663
  if (top < buffer) {
666
664
  translateY = buffer - top;
667
665
  }
668
- else if (bottom > viewportHeight - buffer) {
669
- translateY = viewportHeight - bottom - buffer;
666
+ else if (bottom > buffer) {
667
+ translateY = -bottom - buffer;
670
668
  }
671
669
  // Apply the translation if needed
672
670
  if (translateX !== 0 || translateY !== 0) {
@@ -4947,6 +4945,8 @@
4947
4945
  var _a, _b;
4948
4946
  // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
4949
4947
  addClasses(ghostElement, 'dv-dragged');
4948
+ // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
4949
+ ghostElement.style.top = '-9999px';
4950
4950
  document.body.appendChild(ghostElement);
4951
4951
  dataTransfer.setDragImage(ghostElement, (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0);
4952
4952
  setTimeout(() => {