63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel.DataAnnotations;
|
|
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 int WindowWidth { get; set; } = 1200;
|
|
public int WindowHeight { get; set; } = 800;
|
|
|
|
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);
|
|
}
|
|
|
|
private double _buttonOffset = 0;
|
|
|
|
public double ButtonOffset
|
|
{
|
|
get => _buttonOffset;
|
|
set => SetProperty(ref _buttonOffset, value);
|
|
}
|
|
|
|
private bool _isSplitOpen = false;
|
|
|
|
public bool IsSplitOpen
|
|
{
|
|
get => _isSplitOpen;
|
|
set => SetProperty(ref _isSplitOpen, value);
|
|
}
|
|
|
|
public IRelayCommand DisplaySplitEvent { get; protected set; }
|
|
protected void DisplaySplit()
|
|
{
|
|
IsSplitOpen = !IsSplitOpen;
|
|
}
|
|
}
|