feat: try to fix re-focus issue.
This commit is contained in:
@@ -281,15 +281,9 @@ public class IPv4Box: TemplatedControl
|
|||||||
{
|
{
|
||||||
if (presenter?.Bounds.Contains(position)??false)
|
if (presenter?.Bounds.Contains(position)??false)
|
||||||
{
|
{
|
||||||
_imClient.SetPresenter(presenter, this);
|
|
||||||
RaiseEvent(new TextInputMethodClientRequestedEventArgs()
|
|
||||||
{
|
|
||||||
Source = presenter,
|
|
||||||
Client = _imClient,
|
|
||||||
RoutedEvent = InputElement.TextInputMethodClientRequestedEvent,
|
|
||||||
});
|
|
||||||
if (e.ClickCount == 1)
|
if (e.ClickCount == 1)
|
||||||
{
|
{
|
||||||
|
_imClient.SetPresenter(presenter);
|
||||||
presenter.ShowCaret();
|
presenter.ShowCaret();
|
||||||
_currentActivePresenter = presenter;
|
_currentActivePresenter = presenter;
|
||||||
var caretPosition = position.WithX(position.X - presenter.Bounds.X);
|
var caretPosition = position.WithX(position.X - presenter.Bounds.X);
|
||||||
|
|||||||
@@ -18,21 +18,8 @@ public class IPv4BoxInputMethodClient:TextInputMethodClient
|
|||||||
public override Rect CursorRectangle { get; }
|
public override Rect CursorRectangle { get; }
|
||||||
public override TextSelection Selection { get; set; }
|
public override TextSelection Selection { get; set; }
|
||||||
private IPv4Box? _parent;
|
private IPv4Box? _parent;
|
||||||
public void SetPresenter(TextPresenter? presenter, IPv4Box? parent)
|
public void SetPresenter(TextPresenter? presenter)
|
||||||
{
|
{
|
||||||
if (this._parent != null)
|
|
||||||
this._parent.PropertyChanged -= new EventHandler<AvaloniaPropertyChangedEventArgs>(this.OnParentPropertyChanged);
|
|
||||||
this._parent = parent;
|
|
||||||
if (this._parent != null)
|
|
||||||
this._parent.PropertyChanged += new EventHandler<AvaloniaPropertyChangedEventArgs>(this.OnParentPropertyChanged);
|
|
||||||
TextPresenter presenter1 = this._presenter;
|
|
||||||
if (presenter1 != null)
|
|
||||||
{
|
|
||||||
presenter1.CaretBoundsChanged -= (EventHandler) ((s, e) => this.RaiseCursorRectangleChanged());
|
|
||||||
}
|
|
||||||
this._presenter = presenter;
|
|
||||||
if (this._presenter != null)
|
|
||||||
this._presenter.CaretBoundsChanged += (EventHandler) ((s, e) => this.RaiseCursorRectangleChanged());
|
|
||||||
this.RaiseTextViewVisualChanged();
|
this.RaiseTextViewVisualChanged();
|
||||||
this.RaiseCursorRectangleChanged();
|
this.RaiseCursorRectangleChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user