Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [iOS] Adding view to AbsoluteLayout at runtime: Incorrect positioning #14682

Closed
InquisitorJax opened this issue Oct 1, 2021 · 1 comment
Assignees
Labels
a/layout external-skia i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often t/bug 🐛

Comments

@InquisitorJax
Copy link

Description

Adding a view at runtime to an AbsoluteLayout is adding it in the incorrect position

Steps to Reproduce

  1. Run the sample project on iOS
  2. Tap the pink area

Expected Behavior

The purple box view should be added where the user taps (as in android)

Actual Behavior

The purple box view is added in the incorrect position

Basic Information

  • Version with issue: latest (see attached project)

Screenshots

iOS:
iOSAbs

Android:

AndroidAbs

Reproduction Link

AbsLayoutDrop.zip

Workaround

No work-arounds found - would greatly appreciate it if there was one?

@InquisitorJax InquisitorJax added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 1, 2021
@jsuarezruiz jsuarezruiz added a/layout i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often labels Oct 1, 2021
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Oct 1, 2021
@InquisitorJax
Copy link
Author

InquisitorJax commented Oct 4, 2021

I'm guessing this has something to do with the UIScreen.MainScreen.NativeScale on iOS?

EDIT: Yup - here's a work-around:

AbsoluteLayout.SetLayoutFlags(boxView, AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.YProportional);
var xProportion = (e.Location.X / _device.UIScale) / _canvas.Width;
var yProportion = (e.Location.Y / _device.UIScale) / _canvas.Height;
AbsoluteLayout.SetLayoutBounds(boxView, new Rectangle(xProportion, yProportion, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

where _device is implemented in iOS, and returns public double UIScale => UIScreen.MainScreen.NativeScale;

... so this looks more like an "issue" with Skia in the way that it reports coordinates. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/layout external-skia i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often t/bug 🐛
Projects
None yet
Development

No branches or pull requests

3 participants