dockview 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
3
- * @version 4.2.4
3
+ * @version 4.2.5
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -671,9 +671,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
671
671
  function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
672
672
  const buffer = options.buffer;
673
673
  const rect = element.getBoundingClientRect();
674
- const rootRect = element.getBoundingClientRect();
675
- const viewportWidth = root.clientWidth;
676
- const viewportHeight = root.clientHeight;
674
+ const rootRect = root.getBoundingClientRect();
677
675
  let translateX = 0;
678
676
  let translateY = 0;
679
677
  const left = rect.left - rootRect.left;
@@ -684,15 +682,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
684
682
  if (left < buffer) {
685
683
  translateX = buffer - left;
686
684
  }
687
- else if (right > viewportWidth - buffer) {
688
- translateX = viewportWidth - right - buffer;
685
+ else if (right > buffer) {
686
+ translateX = -buffer - right;
689
687
  }
690
688
  // Check vertical overflow
691
689
  if (top < buffer) {
692
690
  translateY = buffer - top;
693
691
  }
694
- else if (bottom > viewportHeight - buffer) {
695
- translateY = viewportHeight - bottom - buffer;
692
+ else if (bottom > buffer) {
693
+ translateY = -bottom - buffer;
696
694
  }
697
695
  // Apply the translation if needed
698
696
  if (translateX !== 0 || translateY !== 0) {
@@ -4973,6 +4971,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4973
4971
  var _a, _b;
4974
4972
  // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
4975
4973
  addClasses(ghostElement, 'dv-dragged');
4974
+ // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
4975
+ ghostElement.style.top = '-9999px';
4976
4976
  document.body.appendChild(ghostElement);
4977
4977
  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);
4978
4978
  setTimeout(() => {