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
  */
@@ -641,9 +641,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
641
641
  function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
642
642
  const buffer = options.buffer;
643
643
  const rect = element.getBoundingClientRect();
644
- const rootRect = element.getBoundingClientRect();
645
- const viewportWidth = root.clientWidth;
646
- const viewportHeight = root.clientHeight;
644
+ const rootRect = root.getBoundingClientRect();
647
645
  let translateX = 0;
648
646
  let translateY = 0;
649
647
  const left = rect.left - rootRect.left;
@@ -654,15 +652,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
654
652
  if (left < buffer) {
655
653
  translateX = buffer - left;
656
654
  }
657
- else if (right > viewportWidth - buffer) {
658
- translateX = viewportWidth - right - buffer;
655
+ else if (right > buffer) {
656
+ translateX = -buffer - right;
659
657
  }
660
658
  // Check vertical overflow
661
659
  if (top < buffer) {
662
660
  translateY = buffer - top;
663
661
  }
664
- else if (bottom > viewportHeight - buffer) {
665
- translateY = viewportHeight - bottom - buffer;
662
+ else if (bottom > buffer) {
663
+ translateY = -bottom - buffer;
666
664
  }
667
665
  // Apply the translation if needed
668
666
  if (translateX !== 0 || translateY !== 0) {
@@ -4943,6 +4941,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4943
4941
  var _a, _b;
4944
4942
  // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
4945
4943
  addClasses(ghostElement, 'dv-dragged');
4944
+ // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
4945
+ ghostElement.style.top = '-9999px';
4946
4946
  document.body.appendChild(ghostElement);
4947
4947
  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);
4948
4948
  setTimeout(() => {