Skip to content

Commit f79fcc9

Browse files
committed
Release Version 1.7.0
1 parent 480b7f1 commit f79fcc9

10 files changed

+954
-99
lines changed

Nuget/SharpVectors.1.7.0.nupkg

4.97 MB
Binary file not shown.
4.97 MB
Binary file not shown.

Readme.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ The SharpVectors library targets the following frameworks
3636
* .NET Framework, Version 4.8
3737
* .NET Standard, Version 2.1
3838
* .NET Core, Version 3.1
39+
* .NET 5.0
3940

4041
The library can be used in WPF and Windows Forms applications.
4142

4243
### For the Library
4344
The library can be downloaded from the following sources
44-
* **NuGet**, [Version 1.6.0.0](https://www.nuget.org/packages/SharpVectors.Reloaded/).
45-
* **GitHub Releases Page**, [Version 1.6.0.0](https://github.com/ElinamLLC/SharpVectors/releases).
45+
* **NuGet**, [Version 1.7.0.0 - SharpVectors](https://www.nuget.org/packages/SharpVectors/).
46+
* **NuGet**, [Version 1.7.0.0 - SharpVectors.Reloaded](https://www.nuget.org/packages/SharpVectors.Reloaded/).
47+
* **GitHub Releases Page**, [Version 1.7.0.0](https://github.com/ElinamLLC/SharpVectors/releases).
4648

4749
## Documentation
4850
An introduction and a tutorial with sample are available. See the [Documentation](Docs/Documentation.md) section for more information.

Samples/WpfTestSvgControl/DrawingPage.xaml.cs

+70-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
using DpiScale = SharpVectors.Runtime.DpiScale;
2424
using DpiUtilities = SharpVectors.Runtime.DpiUtilities;
25+
using System.Linq;
2526

2627
namespace WpfTestSvgControl
2728
{
@@ -124,6 +125,8 @@ public partial class DrawingPage : Page
124125
private FoldingManager _foldingManager;
125126
private XmlFoldingStrategy _foldingStrategy;
126127

128+
private IList<Color> _colors;
129+
127130
#endregion
128131

129132
#region Constructors and Destructor
@@ -180,7 +183,14 @@ public DrawingPage()
180183
this.Unloaded += OnPageUnloaded;
181184
this.SizeChanged += OnPageSizeChanged;
182185

183-
// svgViewer.Hits += OnDrawingHits;
186+
// svgViewer.Hits += OnDrawingHits;
187+
188+
var colors = from System.Reflection.PropertyInfo property in typeof(Colors).GetProperties()
189+
orderby property.Name
190+
//orderby ((Color)property.GetValue(null, null)).ToString()
191+
select (Color)property.GetValue(null, null);
192+
193+
_colors = colors.ToList();
184194
}
185195

186196
//private void OnDrawingHits(object sender, SvgDrawingHitArgs args)
@@ -483,6 +493,56 @@ protected DrawingGroup WrapDrawing(DrawingGroup currentDrawing)
483493
return currentDrawing;
484494
}
485495

496+
System.Windows.Media.DrawingVisual _drawingVisual = null;
497+
498+
499+
private void DrawDebugHitList(IList<Drawing> drawings, IList<WpfHitPath> hitPaths)
500+
{
501+
if (drawings == null)
502+
{
503+
return;
504+
}
505+
Trace.WriteLine(string.Format("Debug List Count: {0}, {1}", drawings.Count, hitPaths.Count));
506+
// var hitDrawings = new DrawingGroup();
507+
508+
_drawingVisual = new System.Windows.Media.DrawingVisual();
509+
DrawingContext drawingContext = _drawingVisual.RenderOpen();
510+
511+
//drawingContext.PushOpacity(0.5);
512+
513+
for (int i = 0; i < drawings.Count; i++)
514+
{
515+
var drawing = drawings[i];
516+
var boundsDrawing = new GeometryDrawing(null,
517+
new Pen(Brushes.Green, 2), new RectangleGeometry(drawing.Bounds));
518+
//hitDrawings.Children.Add(boundsDrawing);
519+
if (drawings.Count == hitPaths.Count)
520+
{
521+
var hitPath = hitPaths[i];
522+
drawingContext.PushTransform(hitPath.GetTransform(_drawingDocument, drawing));
523+
}
524+
else
525+
{
526+
drawingContext.PushTransform((Transform)svgViewer.DisplayTransform.Inverse);
527+
}
528+
//TransformGroup transforms = new TransformGroup();
529+
//transforms.Children.Add((Transform)svgViewer.DisplayTransform.Inverse);
530+
//transforms.Children.Add(new MatrixTransform(1, 0, 0, 1, -107.61384, -0.044941));
531+
//transforms.Children.Add(new MatrixTransform(1, 0, 0, 1, 118.57143, -70));
532+
//drawingContext.PushTransform(transforms);
533+
// drawingContext.DrawDrawing(hitDrawings);
534+
drawingContext.DrawDrawing(boundsDrawing);
535+
536+
// drawingContext.Pop();
537+
drawingContext.Pop();
538+
}
539+
540+
drawingContext.Close();
541+
542+
svgViewer.HostVisual.Children.Add(_drawingVisual);
543+
//svgViewer.HostVisual.Children.Insert(0, drawingVisual);
544+
}
545+
486546
public Task<bool> LoadDocumentAsync(string svgFilePath)
487547
{
488548
if (_isLoadingDrawing || string.IsNullOrWhiteSpace(svgFilePath))
@@ -928,9 +988,18 @@ private void OnZoomPanMouseUp(object sender, MouseButtonEventArgs e)
928988
{
929989
if (_drawingDocument != null)
930990
{
991+
if (_drawingVisual != null)
992+
{
993+
svgViewer.HostVisual.Children.Remove(_drawingVisual);
994+
_drawingVisual = null;
995+
}
996+
931997
Point point = e.GetPosition(svgViewer);
932998
_drawingDocument.DisplayTransform = svgViewer.DisplayTransform;
933999
var hitResult = _drawingDocument.HitTest(point);
1000+
1001+
DrawDebugHitList(_drawingDocument.HitList, _drawingDocument.HitPaths); //TODO:Testing
1002+
9341003
if (hitResult != null && hitResult.IsHit)
9351004
{
9361005
var selecteElement = hitResult.Element;

0 commit comments

Comments
 (0)