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
  */
@@ -675,9 +675,7 @@
675
675
  function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
676
676
  const buffer = options.buffer;
677
677
  const rect = element.getBoundingClientRect();
678
- const rootRect = element.getBoundingClientRect();
679
- const viewportWidth = root.clientWidth;
680
- const viewportHeight = root.clientHeight;
678
+ const rootRect = root.getBoundingClientRect();
681
679
  let translateX = 0;
682
680
  let translateY = 0;
683
681
  const left = rect.left - rootRect.left;
@@ -688,15 +686,15 @@
688
686
  if (left < buffer) {
689
687
  translateX = buffer - left;
690
688
  }
691
- else if (right > viewportWidth - buffer) {
692
- translateX = viewportWidth - right - buffer;
689
+ else if (right > buffer) {
690
+ translateX = -buffer - right;
693
691
  }
694
692
  // Check vertical overflow
695
693
  if (top < buffer) {
696
694
  translateY = buffer - top;
697
695
  }
698
- else if (bottom > viewportHeight - buffer) {
699
- translateY = viewportHeight - bottom - buffer;
696
+ else if (bottom > buffer) {
697
+ translateY = -bottom - buffer;
700
698
  }
701
699
  // Apply the translation if needed
702
700
  if (translateX !== 0 || translateY !== 0) {
@@ -4977,6 +4975,8 @@
4977
4975
  var _a, _b;
4978
4976
  // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
4979
4977
  addClasses(ghostElement, 'dv-dragged');
4978
+ // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
4979
+ ghostElement.style.top = '-9999px';
4980
4980
  document.body.appendChild(ghostElement);
4981
4981
  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);
4982
4982
  setTimeout(() => {