mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-04-21 10:53:59 +00:00
39 lines
914 B
C#
39 lines
914 B
C#
using Cosmos.System;
|
|
|
|
namespace CMLeonOS.Gui.Apps.Paint.Tools
|
|
{
|
|
internal class LineTool : Tool
|
|
{
|
|
public LineTool() : base("Line")
|
|
{
|
|
}
|
|
|
|
private bool started;
|
|
private int startX;
|
|
private int startY;
|
|
|
|
internal override void Run(Paint paint, Window canvas, MouseState mouseState, int mouseX, int mouseY)
|
|
{
|
|
if (mouseState == MouseState.Left)
|
|
{
|
|
if (!started)
|
|
{
|
|
started = true;
|
|
startX = mouseX;
|
|
startY = mouseY;
|
|
}
|
|
}
|
|
else if (started)
|
|
{
|
|
canvas.DrawLine(startX, startY, mouseX, mouseY, paint.SelectedColor);
|
|
started = false;
|
|
}
|
|
}
|
|
|
|
internal override void Deselected()
|
|
{
|
|
started = false;
|
|
}
|
|
}
|
|
}
|