protected override void UpdateLayout() { if (Parent != null && Parent is TrackBarView) { TrackBarView tw = (TrackBarView)Parent; Rect ra = RenderAreaShrinksByPadding; double deltaTime = (tw.TimeLine.MaxTime - tw.TimeLine.MinTime); foreach (var c in Controls) { c.ScaleFactor = this.ScaleFactor; Rect cRect = ra; if (c is TimeLineEvent) { TimeLineEvent tle = (TimeLineEvent)c; cRect.x = ra.x + ra.width * (float)((tle.FireTime - tw.TimeLine.MinTime) / deltaTime) - tle.CenterOffset; cRect.width = Mathf.Min(tle.MaxWidth, Mathf.Max(tle.MinWidth, ra.width * (float)(tle.Duration / deltaTime))); } else { cRect.x = ra.x + (c.X + c.Margin.Left) * this.ScaleFactor; cRect.y = ra.y + (c.Y + c.Margin.Top) * this.ScaleFactor; cRect.width = c.LayoutWidth * this.ScaleFactor; cRect.height = c.LayoutHeight * this.ScaleFactor; } c.RenderArea = cRect; } } }
/// <summary> /// Create a TimeLineEventDragDumb /// </summary> /// <param name="ownerEvent"></param> public TimeLineEventDragDumb(TimeLineEvent ownerEvent) { if (ownerEvent == null) { throw new System.ArgumentNullException("Invalid TimeLineEvent"); } this.OwnerEvent = ownerEvent; this.WantsMouseEvents = true; }