public override bool Equals(object obj)
        {
            AnimationLayerKey other = obj as AnimationLayerKey;

            return(Object.ReferenceEquals(this, other) || !Object.ReferenceEquals(other, null) &&
                   Object.Equals(this.layerOwner, other.layerOwner));
        }
        public void RemoveClocks(IEnumerable <AnimationTimelineClock> newClocks, AnimationLayerKey key)
        {
            AnimationLayer animationLayer = GetAnimationLayer(key);

            animationLayer.RemoveClocks(newClocks);

            if (key != AnimationLayerKey.Default && animationLayer.IsEmpty)
            {
                RemoveAnimationLayer(key);
            }

            LayerInvalidated.Raise(this);
        }
        public void SetClocks(IEnumerable<AnimationTimelineClock> newClocks, object defaultDestinationValue, AnimationLayerKey key)
        {
            if (newClocks.Any() || key == AnimationLayerKey.Default)
            {
                GetAnimationLayer(key).SetClocks(newClocks, defaultDestinationValue);
            }
            else
            {
                RemoveAnimationLayer(key);
            }

            LayerInvalidated.Raise(this);
        }
        public void RemoveClocks(IEnumerable<AnimationTimelineClock> newClocks, AnimationLayerKey key)
        {
            AnimationLayer animationLayer = GetAnimationLayer(key);

            animationLayer.RemoveClocks(newClocks);

            if (key != AnimationLayerKey.Default && animationLayer.IsEmpty)
            {
                RemoveAnimationLayer(key);
            }

            LayerInvalidated.Raise(this);
        }
        private void RemoveAnimationLayer(AnimationLayerKey key)
        {
            AnimationLayer layer;

            if (key == AnimationLayerKey.Default)
            {
                throw new Granular.Exception("Can't remove default animation layer");
            }

            if (layers.TryGetValue(key, out layer))
            {
                layer.ClockInvalidated -= OnAnimationLayerClockInvalidated;
                layer.Dispose();

                layers.Remove(key);
            }
        }
        private AnimationLayer GetAnimationLayer(AnimationLayerKey key)
        {
            if (key == AnimationLayerKey.Default)
            {
                return(defaultLayer);
            }

            AnimationLayer layer;

            if (!layers.TryGetValue(key, out layer))
            {
                layer = new AnimationLayer();
                layer.ClockInvalidated += OnAnimationLayerClockInvalidated;

                layers.Add(key, layer);
            }

            return(layer);
        }
 public void AddClocks(IEnumerable <AnimationTimelineClock> newClocks, AnimationLayerKey key)
 {
     GetAnimationLayer(key).AddClocks(newClocks);
     LayerInvalidated.Raise(this);
 }
        public void SetClocks(IEnumerable <AnimationTimelineClock> newClocks, object defaultDestinationValue, AnimationLayerKey key)
        {
            if (newClocks.Any() || key == AnimationLayerKey.Default)
            {
                GetAnimationLayer(key).SetClocks(newClocks, defaultDestinationValue);
            }
            else
            {
                RemoveAnimationLayer(key);
            }

            LayerInvalidated.Raise(this);
        }
Example #9
0
 public void RemoveClocks(IEnumerable <AnimationTimelineClock> clocks, object layerOwner)
 {
     layers.RemoveClocks(clocks, AnimationLayerKey.FromLayerOwner(layerOwner));
 }
Example #10
0
 public void SetClocks(IEnumerable <AnimationTimelineClock> clocks, object layerOwner)
 {
     layers.SetClocks(clocks, GetAnimationBaseValue(), AnimationLayerKey.FromLayerOwner(layerOwner));
 }
        private AnimationLayer GetAnimationLayer(AnimationLayerKey key)
        {
            if (key == AnimationLayerKey.Default)
            {
                return defaultLayer;
            }

            AnimationLayer layer;

            if (!layers.TryGetValue(key, out layer))
            {
                layer = new AnimationLayer();
                layer.ClockInvalidated += OnAnimationLayerClockInvalidated;

                layers.Add(key, layer);
            }

            return layer;
        }
 public void AddClocks(IEnumerable<AnimationTimelineClock> newClocks, AnimationLayerKey key)
 {
     GetAnimationLayer(key).AddClocks(newClocks);
     LayerInvalidated.Raise(this);
 }
        private void RemoveAnimationLayer(AnimationLayerKey key)
        {
            AnimationLayer layer;

            if (key == AnimationLayerKey.Default)
            {
                throw new Granular.Exception("Can't remove default animation layer");
            }

            if (layers.TryGetValue(key, out layer))
            {
                layer.ClockInvalidated -= OnAnimationLayerClockInvalidated;
                layer.Dispose();

                layers.Remove(key);
            }
        }