From a5a9a3f5bcf3dbaf487beadcf608b4a953ef6d75 Mon Sep 17 00:00:00 2001 From: infinity8 Date: Fri, 9 Sep 2016 21:10:18 +0100 Subject: [PATCH] Show circles for the timeline values at each keyframe. Fix default name of timeline elements --- StructuredXmlEditor/Core.xmldef | 2 +- .../View/CustomControls/Timeline.cs | 32 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/StructuredXmlEditor/Core.xmldef b/StructuredXmlEditor/Core.xmldef index 39d96f2..ac982dd 100644 --- a/StructuredXmlEditor/Core.xmldef +++ b/StructuredXmlEditor/Core.xmldef @@ -209,7 +209,7 @@ - + diff --git a/StructuredXmlEditor/View/CustomControls/Timeline.cs b/StructuredXmlEditor/View/CustomControls/Timeline.cs index 97992ed..789991f 100644 --- a/StructuredXmlEditor/View/CustomControls/Timeline.cs +++ b/StructuredXmlEditor/View/CustomControls/Timeline.cs @@ -151,7 +151,20 @@ protected override void OnRender(DrawingContext drawingContext) var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad; var nextDrawPos = TimelineItem.GetKeyframeTime(nextKeyframe) * pixelsASecond + TimelineItem.LeftPad; - drawingContext.DrawRectangle(brush, null, new Rect(thisDrawPos, drawPos, nextDrawPos - thisDrawPos, lineHeight)); + drawingContext.DrawRectangle(brush, indicatorPen, new Rect(thisDrawPos, drawPos, nextDrawPos - thisDrawPos, lineHeight)); + } + + for (int ii = 0; ii < sortedKeyframes.Count; ii++) + { + var thisKeyframe = sortedKeyframes[ii]; + + var thisCol = TimelineItem.GetColourData(thisKeyframe, i); + + var brush = new SolidColorBrush(thisCol); + + var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad; + + drawingContext.DrawRoundedRectangle(brush, indicatorPen, new Rect(thisDrawPos-5, (drawPos+lineHeight/2)-5, 10, 10), 5, 5); } } @@ -190,8 +203,25 @@ protected override void OnRender(DrawingContext drawingContext) var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad; var nextDrawPos = TimelineItem.GetKeyframeTime(nextKeyframe) * pixelsASecond + TimelineItem.LeftPad; + var borderPen = new Pen(IndicatorBrush, 4); + drawingContext.DrawLine(borderPen, new Point(thisDrawPos, thisH), new Point(nextDrawPos, nextH)); drawingContext.DrawLine(pen, new Point(thisDrawPos, thisH), new Point(nextDrawPos, nextH)); } + + for (int ii = 0; ii < sortedKeyframes.Count; ii++) + { + var thisKeyframe = sortedKeyframes[ii]; + + var thisNum = TimelineItem.GetNumberData(thisKeyframe, i); + + var thisAlpha = (thisNum - min) / (max - min); + + var thisH = (ActualHeight - 20) - (ActualHeight - 25) * thisAlpha; + + var thisDrawPos = TimelineItem.GetKeyframeTime(thisKeyframe) * pixelsASecond + TimelineItem.LeftPad; + + drawingContext.DrawRoundedRectangle(pen.Brush, indicatorPen, new Rect(thisDrawPos - 5, thisH - 5, 10, 10), 5, 5); + } } }