36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using System.Collections.ObjectModel;
|
|
using Avalonia.Input;
|
|
using Avalonia.Media;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using SimpleDraw.Models;
|
|
|
|
namespace SimpleDraw.ViewModels;
|
|
|
|
public class ViewModelBase : ObservableObject
|
|
{
|
|
public ObservableCollection<ColorPickerButton>? ColorPalette { get; set; }
|
|
public IRelayCommand<PointerPressedEventArgs>? CanvasPointerPressedCommand { get; set; }
|
|
public IRelayCommand<PointerEventArgs>? CanvasPointerMovedCommand { get; set; }
|
|
public IRelayCommand<PointerReleasedEventArgs>? CanvasPointerReleasedCommand { get; set; }
|
|
public ObservableCollection<DrawingPoints> DrawingPoints { get; set; } = new();
|
|
public DrawingPoints? DrawingPoint { get; set; }
|
|
|
|
protected bool IsDrawing { get; set; }
|
|
|
|
private Brush _brush = new SolidColorBrush(new Color(a: 255, r: 0, g: 0, b: 0));
|
|
private double _brushThickness = 2.0;
|
|
|
|
protected Brush Brush
|
|
{
|
|
get => _brush;
|
|
set => SetProperty(ref _brush, value);
|
|
}
|
|
|
|
public double BrushThickness
|
|
{
|
|
get => _brushThickness;
|
|
set => SetProperty(ref _brushThickness, value);
|
|
}
|
|
}
|