Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Fix Entry/Editor cursor position issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz committed May 31, 2023
1 parent ab57c66 commit a597a5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 7 additions & 5 deletions src/GraphicsControls/Handlers/Editor/EditorHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ protected override GraphicsEditor CreatePlatformView()
nativeView.Gravity = GravityFlags.Top;
nativeView.TextAlignment = ATextAlignment.ViewStart;
nativeView.SetHorizontallyScrolling(false);

var density = nativeView.Resources?.DisplayMetrics?.Density ?? 1.0f;

if (Drawable is MaterialEditorDrawable)
nativeView.SetPadding(12, 18, 0, 0);
else if (Drawable is FluentEditorDrawable)
nativeView.SetPadding(12, 12, 0, 0);
if (Drawable is MaterialEditorDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 24), 0, 0);
else if (Drawable is FluentEditorDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);
else if (Drawable is CupertinoEditorDrawable)
nativeView.SetPadding(12, 12, 0, 0);
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);

return nativeView;
}
Expand Down
8 changes: 5 additions & 3 deletions src/GraphicsControls/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ protected override GraphicsEntry CreatePlatformView()
{
GraphicsControl = this
};

var density = nativeView.Resources?.DisplayMetrics?.Density ?? 1.0f;

if (Drawable is MaterialEntryDrawable)
nativeView.SetPadding(12, 18, 0, 0);
nativeView.SetPadding((int)(density * 12), (int)(density * 24), 0, 0);
else if (Drawable is FluentEntryDrawable)
nativeView.SetPadding(12, 12, 0, 0);
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);
else if (Drawable is CupertinoEntryDrawable)
nativeView.SetPadding(12, 12, 0, 0);
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);

return nativeView;
}
Expand Down

0 comments on commit a597a5c

Please sign in to comment.