Ejemplo n.º 1
0
        public ValueTrackView(TLValueTrack track, TimelineView tv, RulerView rv)
            : base(track, tv, rv)
        {
            Keyframes = new EditableList <ValueKeyframeView>();

            KFSyncer = Keyframes.SyncWith(Model.Keyframes,
                                          kf =>
            {
                var kv = new ValueKeyframeView(kf, this);
                kf.NeighbourChanged += NeedsRebuild;
                var kfs              = Model.Keyframes.ToList();
                var prev             = kfs.FindLastIndex(x => x.Time.Value < kf.Time.Value);
                kv.AddToSceneGraphAt(KeyframeGroup, Keyframes.Count - 1 - prev);
                return(kv);
            },
                                          kv =>
            {
                kv.Model.NeighbourChanged -= NeedsRebuild;
                kv.Dispose();
            });

            CurveSyncer = Curves.SyncWith(Model.Curves,
                                          cu =>
            {
                var cv = new CurveView(cu, this);
                cv.AddToSceneGraphAt(CurveGroup);
                return(cv);
            },
                                          cv =>
            {
                cv.Dispose();
            }
                                          );

            Background.Click += Background_MouseClick;

            KeyframeDefinition.CenterX    = 0;
            KeyframeDefinition.CenterY    = 0;
            KeyframeDefinition.Radius     = 3;
            KeyframeDefinition.ID         = Model.GetID() + "_KF";
            KeyframeDefinition.Transforms = new SvgTransformCollection();
            KeyframeDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseNoneDefinition.ID         = Model.GetID() + "_NE";
            EaseNoneDefinition.StartX     = 0;
            EaseNoneDefinition.StartY     = -25f;
            EaseNoneDefinition.EndX       = 0;
            EaseNoneDefinition.EndY       = 25f;
            EaseNoneDefinition.Transforms = new SvgTransformCollection();
            EaseNoneDefinition.Transforms.Add(new SvgScale(1, 1));

            var half = Model.CCollapsedHeight / 2f;

            EaseInDefinition.ID     = Model.GetID() + "_EI";
            EaseInDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseInDefinition, new PointF(0, -half));
            AddPoint(EaseInDefinition, new PointF(-half, 0));
            AddPoint(EaseInDefinition, new PointF(0, half));
            EaseInDefinition.Transforms = new SvgTransformCollection();
            EaseInDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseOutDefinition.ID     = Model.GetID() + "_EO";
            EaseOutDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseOutDefinition, new PointF(0, -half));
            AddPoint(EaseOutDefinition, new PointF(half, 0));
            AddPoint(EaseOutDefinition, new PointF(0, half));
            EaseOutDefinition.Transforms = new SvgTransformCollection();
            EaseOutDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseInOutDefinition.ID     = Model.GetID() + "_EIO";
            EaseInOutDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseInOutDefinition, new PointF(0, -half));
            AddPoint(EaseInOutDefinition, new PointF(half, 0));
            AddPoint(EaseInOutDefinition, new PointF(0, half));
            AddPoint(EaseInOutDefinition, new PointF(-half, 0));
            EaseInOutDefinition.Transforms = new SvgTransformCollection();
            EaseInOutDefinition.Transforms.Add(new SvgScale(1, 1));

            CurveGroup.ID    = "Curves";
            KeyframeGroup.ID = "Keyframes";

            CurrentValue.FontSize = 12;
            CurrentValue.X        = 5;
            CurrentValue.CustomAttributes["class"]          = "trackfont";
            CurrentValue.CustomAttributes["pointer-events"] = "none";
            CurrentValue.Y = 24;

            UpdateScene();
        }
Ejemplo n.º 2
0
        public ValueTrackView(TLValueTrack track, TimelineView tv, RulerView rv)
            : base(track, tv, rv)
        {
            Keyframes = new EditableList<ValueKeyframeView>();

            KFSyncer = Keyframes.SyncWith(Model.Keyframes,
                                          kf =>
                                          {
                                          	var kv = new ValueKeyframeView(kf, this);
                                          	kf.NeighbourChanged += NeedsRebuild;
                                          	var kfs = Model.Keyframes.ToList();
                                          	var prev = kfs.FindLastIndex(x => x.Time.Value < kf.Time.Value);
                                          	kv.AddToSceneGraphAt(KeyframeGroup, Keyframes.Count - 1 - prev);
                                          	return kv;
                                          },
                                          kv =>
                                          {
                                          	kv.Model.NeighbourChanged -= NeedsRebuild;
                                          	kv.Dispose();
                                          });

            CurveSyncer = Curves.SyncWith(Model.Curves,
                                          cu =>
                                          {
                                          	var cv = new CurveView(cu, this);
                                          	cv.AddToSceneGraphAt(CurveGroup);
                                          	return cv;
                                          },
                                          cv =>
                                          {
                                          	cv.Dispose();
                                          }
                                         );

            Background.Click += Background_MouseClick;

            KeyframeDefinition.CenterX = 0;
            KeyframeDefinition.CenterY = 0;
            KeyframeDefinition.Radius = 3;
            KeyframeDefinition.ID = Model.GetID() + "_KF";
            KeyframeDefinition.Transforms = new SvgTransformCollection();
            KeyframeDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseNoneDefinition.ID = Model.GetID() + "_NE";
            EaseNoneDefinition.StartX = 0;
            EaseNoneDefinition.StartY = -25f;
            EaseNoneDefinition.EndX = 0;
            EaseNoneDefinition.EndY = 25f;
            EaseNoneDefinition.Transforms = new SvgTransformCollection();
            EaseNoneDefinition.Transforms.Add(new SvgScale(1, 1));

            var half = Model.CCollapsedHeight / 2f;

            EaseInDefinition.ID = Model.GetID() + "_EI";
            EaseInDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseInDefinition, new PointF(0, -half));
            AddPoint(EaseInDefinition, new PointF(-half, 0));
            AddPoint(EaseInDefinition, new PointF(0, half));
            EaseInDefinition.Transforms = new SvgTransformCollection();
            EaseInDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseOutDefinition.ID = Model.GetID() + "_EO";
            EaseOutDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseOutDefinition, new PointF(0, -half));
            AddPoint(EaseOutDefinition, new PointF(half, 0));
            AddPoint(EaseOutDefinition, new PointF(0, half));
            EaseOutDefinition.Transforms = new SvgTransformCollection();
            EaseOutDefinition.Transforms.Add(new SvgScale(1, 1));

            EaseInOutDefinition.ID = Model.GetID() + "_EIO";
            EaseInOutDefinition.Points = new SvgUnitCollection();
            AddPoint(EaseInOutDefinition, new PointF(0, -half));
            AddPoint(EaseInOutDefinition, new PointF(half, 0));
            AddPoint(EaseInOutDefinition, new PointF(0, half));
            AddPoint(EaseInOutDefinition, new PointF(-half, 0));
            EaseInOutDefinition.Transforms = new SvgTransformCollection();
            EaseInOutDefinition.Transforms.Add(new SvgScale(1, 1));

            CurveGroup.ID = "Curves";
            KeyframeGroup.ID = "Keyframes";

            CurrentValue.FontSize = 12;
            CurrentValue.X = 5;
            CurrentValue.CustomAttributes["class"] = "trackfont";
            CurrentValue.CustomAttributes["pointer-events"] = "none";
            CurrentValue.Y = 24;

            UpdateScene();
        }