LearnNewsExamplesServices
Frontmatter
id8164
titleEnhance Neo.manager.Window to Track Full Window Geometry
stateClosed
labels
enhancementaiarchitecture
assigneestobiu
createdAtDec 27, 2025, 10:30 PM
updatedAtDec 28, 2025, 12:53 AM
githubUrlhttps://github.com/neomjs/neo/issues/8164
authortobiu
commentsCount1
parentIssue8163
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 28, 2025, 12:53 AM

Enhance Neo.manager.Window to Track Full Window Geometry

Closed v11.18.0 enhancementaiarchitecture
tobiu
tobiu commented on Dec 27, 2025, 10:30 PM

During the implementation of cross-window drag & drop, we discovered that Neo.manager.Window primarily tracked the outer window rect (screen coordinates of the frame). To correctly position elements inside the viewport (like the drag proxy), we patched it to calculate headerHeight (outerHeight - innerHeight).

Issue: The current Window model is incomplete. It confounds "Screen Position" (Frame) with "Content Position" (Viewport). This leads to ad-hoc calculations in consumers like DragCoordinator to infer the browser chrome size.

Goal: Refactor Neo.manager.Window to explicitly track and expose:

  1. outerRect: The window frame on the OS screen.
  2. innerRect (or viewportRect): The content area on the OS screen.
  3. chromeDimensions: Top/Left/Right/Bottom border sizes.

Benefits:

  • Simplifies cross-window positioning (popups, proxies, infinite canvas).
  • Enables precise "center on parent content" logic.
  • Removes fragile headerHeight assumptions.
tobiu added the enhancement label on Dec 27, 2025, 10:30 PM
tobiu added the ai label on Dec 27, 2025, 10:30 PM
tobiu added the architecture label on Dec 27, 2025, 10:30 PM
tobiu added parent issue #8163 on Dec 27, 2025, 10:33 PM
tobiu assigned to @tobiu on Dec 28, 2025, 12:00 AM
tobiu referenced in commit 146980c - "Neo.manager.Window: Implement full window geometry tracking with Cross-Browser Viewport Support - #8164 on Dec 28, 2025, 12:52 AM
tobiu
tobiu Dec 28, 2025, 12:53 AM

Input from gemini:

✦ I have implemented the enhanced window geometry tracking to support the "Infinite Canvas" across different browsers.

Key Changes:

  1. Refactored Neo.manager.Window:

    • Added calculateGeometry to interpret raw window data and derive innerRect (viewport), outerRect (frame), and chrome dimensions.
    • Implemented browser-specific logic:
      • Firefox: Uses mozInnerScreenX/Y directly for precise viewport positioning.
      • Safari: Uses isSafari flag (cached via navigator.userAgent) to correct for the frame-based screenLeft/Top coordinates by adding calculated chrome.
      • Chrome/Edge: Uses screenLeft/Top as the viewport origin (standard behavior).
    • Updated onWindowConnect and onWindowPositionChange to use this robust logic.
  2. Updated Neo.manager.DragCoordinator:

    • Switched from manual, brittle coordinate calculations to using the new targetWindow.innerRect. This ensures drop targets are detected exactly where the user sees them, regardless of browser chrome size.
  3. Updated Neo.Main:

    • Modified getWindowData to report raw sensor data, including mozInnerScreenX/Y. It now acts as a dumb sensor, delegating interpretation to the Worker.
  4. Reverted Neo.main.addon.WindowPosition:

    • Restored to its simpler state of tracking raw screenLeft/Top for movement detection, maintaining clean separation of concerns.

This foundation allows precise cross-window coordinate mapping for all major browsers.

tobiu closed this issue on Dec 28, 2025, 12:53 AM