Skip to content

feat(windows): view location in window, on screen and relative to a view - #11515

Merged
triniwiz merged 7 commits into
fix/windows-parent-percent-sizingfrom
fix/windows-view-location
Oct 23, 2026
Merged

triniwiz merged 7 commits into
fix/windows-parent-percent-sizingfrom
fix/windows-view-location

Conversation

@triniwiz

@triniwiz triniwiz commented Oct 9, 2026

Copy link
Copy Markdown
Member

PR Checklist

What is the current behavior?

On Windows, getLocationInWindow(), getLocationOnScreen() and getLocationRelativeTo() fall through to ViewCommon and return undefined.

What is the new behavior?

The Windows View implements all three, in DIPs as on Android and iOS:

  • getLocationInWindow(): the element's origin through TransformToVisual(null).
  • getLocationRelativeTo(other): the origin through TransformToVisual(other). It returns undefined unless both views share a XamlRoot.
  • getLocationOnScreen(): the in-window location plus the window's client-area origin. A new getClientOriginOnScreen(xamlRoot) util in window-helper.windows.ts reads that origin from the AppWindow (outer position plus frame insets, divided by the window scale) and caches each root's AppWindow.

Each call makes one or two native calls, and the origin point is created once.

Stacked on #11468 (base fix/windows-parent-percent-sizing).

Testing:

  • Tested on Windows x64 with nativescript-mason's WebSpec suite. It measures every fixture with getActualSize() and getLocationRelativeTo(): 416/416 pass without the suite's own Windows workarounds.
  • At 125% scale, getLocationOnScreen() for the window content matched Win32 ClientToScreen (109.6 × 132.8 DIPs).
  • tsc -p packages/core/tsconfig.lib.json reports no errors.
  • There are no specs for the Windows view.

getLocationInWindow and getLocationRelativeTo transform the element's origin
through XAML; getLocationOnScreen adds the window's client origin, read off its
AppWindow (cached per XamlRoot) by a window-helper util.
@nx-cloud

nx-cloud Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 83ee840

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 13s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-19 13:22:10 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11515
npm i https://pkg.pr.new/@nativescript/vite@11515
npm i https://pkg.pr.new/@nativescript/webpack@11515

commit: 106a6da

@triniwiz
triniwiz merged commit 3917e9f into fix/windows-parent-percent-sizing Oct 23, 2026
7 checks passed
@triniwiz
triniwiz deleted the fix/windows-view-location branch October 23, 2026 03:34
triniwiz added a commit that referenced this pull request Oct 23, 2026
…11468)

* feat(windows): let a parent resolve its children's percentage sizes

View gains _setChildPercentSize(child, horizontal, fraction), which
returns false. A percentage width or height is handed to the parent's;
when it returns true, core leaves the XAML Width/Height unset and skips
its own percent sizing. Setting a length clears it (fraction null).

* feat(windows): view location in window, on screen and relative to a view (#11515)

getLocationInWindow and getLocationRelativeTo transform the element's origin
through XAML; getLocationOnScreen adds the window's client origin, read off its
AppWindow (cached per XamlRoot) by a window-helper util.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant