From 6306915f5b27e2faa7a93ac1df79693bd7a70b4d Mon Sep 17 00:00:00 2001 From: ARCHI86 Date: Sat, 2 Nov 2024 19:31:35 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GraphPage.xaml | 8 ++++++++ GraphPage.xaml.cs | 43 ++----------------------------------------- 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/GraphPage.xaml b/GraphPage.xaml index 79fb8ce..e932dbc 100644 --- a/GraphPage.xaml +++ b/GraphPage.xaml @@ -11,8 +11,16 @@ + + + + \ No newline at end of file diff --git a/GraphPage.xaml.cs b/GraphPage.xaml.cs index c3f9f78..fa54ec3 100644 --- a/GraphPage.xaml.cs +++ b/GraphPage.xaml.cs @@ -6,7 +6,7 @@ namespace NotesDataAnalyst public partial class GraphPage : ContentPage { - private readonly Entry _textEditor; // Ïîëå äëÿ ââîäà òåêñòà + private PointF _initialNodePosition; // Õðàíèò íà÷àëüíóþ ïîçèöèþ íîäû private PointF _initialTouchPosition; // Õðàíèò íà÷àëüíóþ ïîçèöèþ êàñàíèÿ private SizeF _initialNodeSize; // Õðàíèò íà÷àëüíûé ðàçìåð íîäû @@ -20,16 +20,7 @@ namespace NotesDataAnalyst { InitializeComponent(); - // Ñîçäàåì ñêðûòîå ïîëå äëÿ ðåäàêòèðîâàíèÿ òåêñòà - _textEditor = new Entry - { - IsVisible = false, - BackgroundColor = Colors.Transparent, - FontSize = 18, - TextColor = Colors.Black - }; - _textEditor.Completed += OnTextEditorCompleted; // Ñîõðàíÿåì òåêñò ïðè çàâåðøåíèè ââîäà - this.Add(_textEditor); + // Íàñòðàèâàåì Drawable äëÿ îòðèñîâêè óçëîâ è ñâÿçåé var graphDrawable = new GraphDrawable(_nodes, _connections); @@ -49,38 +40,8 @@ namespace NotesDataAnalyst { var node = _selectedNode; - var tapPosition = e.GetPosition((View)sender); - if (tapPosition.HasValue) - { - var touchPoint = new PointF((float)tapPosition.Value.X, (float)tapPosition.Value.Y); - _selectedNode = _nodes.FirstOrDefault(node => IsPointInsideNode(touchPoint, node)); - - if (_selectedNode != null) - { - // Ïîçèöèîíèðóåì è ïîêàçûâàåì òåêñòîâîå ïîëå - _textEditor.Text = _selectedNode.Text; - _textEditor.IsVisible = true; - _textEditor.Focus(); - AbsoluteLayout.SetLayoutBounds(_textEditor, new Rect(_selectedNode.Position.X + 5, _selectedNode.Position.Y + 5, _selectedNode.Size.Width - 10, 30)); - } - } - Debug.WriteLine("Íàæàòà íîäà - {node}"); } - - private void OnTextEditorCompleted(object sender, EventArgs e) - { - // Ñîõðàíÿåì òåêñò â íîäó - if (_selectedNode != null) - { - _selectedNode.Text = _textEditor.Text; - _textEditor.IsVisible = false; - canvasView.Invalidate(); - } - } - - - private void OnChildClicked(object sender, EventArgs e) { if (_selectedNode != null)