stable
This commit is contained in:
commit
d55d8bc32d
93 files changed
+13507
No files matched your search
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Kniip.Editor.Annotations;
|
||||
|
||||
/// <summary>
|
||||
/// Een bewerkbaar object op het knipsel. Coördinaten zijn in pixels van de afbeelding;
|
||||
/// annotaties worden pas bij het exporteren "plat" gemaakt.
|
||||
/// </summary>
|
||||
public abstract class Annotation
|
||||
{
|
||||
public StyleSet Style { get; set; } = new();
|
||||
|
||||
/// <summary>Tijdelijk verborgen, bijvoorbeeld terwijl een tekstkader wordt bewerkt.</summary>
|
||||
public bool IsHidden { get; set; }
|
||||
|
||||
public abstract ToolKind Kind { get; }
|
||||
|
||||
public abstract Rect Bounds { get; }
|
||||
|
||||
public abstract void Render(DrawingContext dc, EditorDocument document);
|
||||
|
||||
public virtual bool HitTest(Point point, double tolerance)
|
||||
{
|
||||
Rect bounds = Bounds;
|
||||
bounds.Inflate(tolerance, tolerance);
|
||||
return bounds.Contains(point);
|
||||
}
|
||||
|
||||
public abstract void Move(Vector delta);
|
||||
|
||||
public virtual IReadOnlyList<Point> GetHandles() => Array.Empty<Point>();
|
||||
|
||||
public virtual void BeginHandleDrag(int index)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void MoveHandle(int index, Point point, bool constrain)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Te klein om te bewaren na het tekenen (bijv. een losse klik met het rechthoek-gereedschap).</summary>
|
||||
public virtual bool IsDegenerate => false;
|
||||
|
||||
public virtual Annotation Clone()
|
||||
{
|
||||
var clone = (Annotation)MemberwiseClone();
|
||||
clone.Style = Style.Clone();
|
||||
clone.IsHidden = false;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user