cloud-ide-element 1.1.26 → 1.1.27

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.
@@ -300,40 +300,42 @@ class PortalService {
300
300
  let top;
301
301
  let position = 'bottom'; // Default to bottom
302
302
  // Determine if we should open above or below
303
+ // Note: Using fixed positioning, so positions are relative to viewport (no scroll offset needed)
303
304
  if (config.position === 'auto' || !config.position) {
304
305
  // Auto-detect: prefer bottom, but use top if not enough space below
305
306
  if (spaceBelow < estimatedHeight && spaceAbove > estimatedHeight) {
306
307
  position = 'top';
307
- top = rect.top + window.scrollY - estimatedHeight - offsetY;
308
+ top = rect.top - estimatedHeight - offsetY;
308
309
  }
309
310
  else {
310
311
  position = 'bottom';
311
- top = rect.bottom + window.scrollY + offsetY;
312
+ top = rect.bottom + offsetY;
312
313
  }
313
314
  }
314
315
  else if (config.position === 'top') {
315
316
  position = 'top';
316
- top = rect.top + window.scrollY - estimatedHeight - offsetY;
317
+ top = rect.top - estimatedHeight - offsetY;
317
318
  }
318
319
  else {
319
320
  position = 'bottom';
320
- top = rect.bottom + window.scrollY + offsetY;
321
+ top = rect.bottom + offsetY;
321
322
  }
322
- let left = rect.left + window.scrollX + offsetX;
323
+ let left = rect.left + offsetX;
323
324
  // Auto-detect horizontal alignment
325
+ // Note: Using fixed positioning, so positions are relative to viewport (no scroll offset needed)
324
326
  if (config.align === 'auto' || !config.align) {
325
327
  const spaceRight = viewport.width - rect.left;
326
328
  const spaceLeft = rect.right;
327
329
  if (spaceRight < estimatedWidth && spaceLeft > estimatedWidth) {
328
330
  // Align to right edge of trigger
329
- left = rect.right + window.scrollX - estimatedWidth;
331
+ left = rect.right - estimatedWidth;
330
332
  }
331
333
  }
332
334
  else if (config.align === 'right') {
333
- left = rect.right + window.scrollX - estimatedWidth;
335
+ left = rect.right - estimatedWidth;
334
336
  }
335
337
  else if (config.align === 'center') {
336
- left = rect.left + window.scrollX + (rect.width / 2) - (estimatedWidth / 2);
338
+ left = rect.left + (rect.width / 2) - (estimatedWidth / 2);
337
339
  }
338
340
  return {
339
341
  top,
@@ -352,11 +354,12 @@ class PortalService {
352
354
  let adjustedLeft = parseInt(portal.style.left);
353
355
  let adjustedTop = parseInt(portal.style.top);
354
356
  // Adjust horizontal position if portal goes outside viewport
357
+ // Note: Using fixed positioning, so positions are relative to viewport (no scroll offset needed)
355
358
  if (portalRect.right > viewport.width) {
356
- adjustedLeft = triggerRect.right + window.scrollX - portalRect.width;
359
+ adjustedLeft = triggerRect.right - portalRect.width;
357
360
  }
358
361
  if (portalRect.left < 0) {
359
- adjustedLeft = window.scrollX + 4; // Small margin from edge
362
+ adjustedLeft = 4; // Small margin from edge
360
363
  }
361
364
  // Smart vertical adjustment - flip to opposite side if needed
362
365
  const spaceBelow = viewport.height - triggerRect.bottom;
@@ -364,19 +367,19 @@ class PortalService {
364
367
  const portalHeight = portalRect.height;
365
368
  // If portal goes below viewport and there's more space above, flip to top
366
369
  if (portalRect.bottom > viewport.height && spaceAbove > portalHeight) {
367
- adjustedTop = triggerRect.top + window.scrollY - portalHeight - 4;
370
+ adjustedTop = triggerRect.top - portalHeight - 4;
368
371
  }
369
372
  // If portal goes above viewport and there's more space below, flip to bottom
370
373
  else if (portalRect.top < 0 && spaceBelow > portalHeight) {
371
- adjustedTop = triggerRect.bottom + window.scrollY + 4;
374
+ adjustedTop = triggerRect.bottom + 4;
372
375
  }
373
376
  // If still outside viewport, adjust to fit within bounds
374
377
  else {
375
378
  if (portalRect.bottom > viewport.height) {
376
- adjustedTop = viewport.height + window.scrollY - portalHeight - 4;
379
+ adjustedTop = viewport.height - portalHeight - 4;
377
380
  }
378
381
  if (portalRect.top < 0) {
379
- adjustedTop = window.scrollY + 4; // Small margin from top
382
+ adjustedTop = 4; // Small margin from top
380
383
  }
381
384
  }
382
385
  portal.style.left = `${adjustedLeft}px`;