dockview-core 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.
@@ -3,6 +3,8 @@ export function addGhostImage(dataTransfer, ghostElement, options) {
3
3
  var _a, _b;
4
4
  // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
5
5
  addClasses(ghostElement, 'dv-dragged');
6
+ // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
7
+ ghostElement.style.top = '-9999px';
6
8
  document.body.appendChild(ghostElement);
7
9
  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);
8
10
  setTimeout(() => {
package/dist/esm/dom.js CHANGED
@@ -317,9 +317,7 @@ export function onDidWindowResizeEnd(element, cb) {
317
317
  export function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
318
318
  const buffer = options.buffer;
319
319
  const rect = element.getBoundingClientRect();
320
- const rootRect = element.getBoundingClientRect();
321
- const viewportWidth = root.clientWidth;
322
- const viewportHeight = root.clientHeight;
320
+ const rootRect = root.getBoundingClientRect();
323
321
  let translateX = 0;
324
322
  let translateY = 0;
325
323
  const left = rect.left - rootRect.left;
@@ -330,15 +328,15 @@ export function shiftAbsoluteElementIntoView(element, root, options = { buffer:
330
328
  if (left < buffer) {
331
329
  translateX = buffer - left;
332
330
  }
333
- else if (right > viewportWidth - buffer) {
334
- translateX = viewportWidth - right - buffer;
331
+ else if (right > buffer) {
332
+ translateX = -buffer - right;
335
333
  }
336
334
  // Check vertical overflow
337
335
  if (top < buffer) {
338
336
  translateY = buffer - top;
339
337
  }
340
- else if (bottom > viewportHeight - buffer) {
341
- translateY = viewportHeight - bottom - buffer;
338
+ else if (bottom > buffer) {
339
+ translateY = -bottom - buffer;
342
340
  }
343
341
  // Apply the translation if needed
344
342
  if (translateX !== 0 || translateY !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-core",
3
- "version": "4.2.4",
3
+ "version": "4.2.5",
4
4
  "description": "Zero dependency layout manager supporting tabs, grids and splitviews",
5
5
  "keywords": [
6
6
  "splitview",