예제 #1
0
        private void SendActiveEvent(MouseInput input)
        {
            InputData newInput = CreateInputData(input);

            switch (input.State)
            {
            case InputState.Start:
                StartDraw?.Invoke(newInput);
                _previousInput = newInput;
                break;

            case InputState.Draw:
                if (newInput.Position != _previousInput.Position)
                {
                    DrawCall?.Invoke(newInput);
                    _previousInput = newInput;
                }
                break;

            case InputState.End:
                EndDraw?.Invoke(newInput);
                _previousInput = default;
                break;

            default:
                throw new Exception("Try send active event to disactive input");
            }
        }
예제 #2
0
        private void RedrawField()
        {
            lock (_drawLocker)
            {
                _graph.Clear(Color.White);
                foreach (var node in _model.RootNodes)
                {
                    var x = Convert.ToInt32(node.Position.X - (int)node.CapturingRadius);
                    var y = Convert.ToInt32(node.Position.Y - (int)node.CapturingRadius);

                    _graph.DrawImageUnscaled(node.IsSelected ? BaseSprites.SelectedPoint : BaseSprites.Point, x, y);
                }
                EndDraw?.Invoke(this, null);
            }
        }