internal void TransferLayer(LayerController layer, SliceController slice, int id = 0) { if (slice == this) { throw new ArgumentException("New slice can't be this slice."); } CheckLayerExist(layer); int slicesStart, slicesEnd; if (this.id < slice.id) { slicesStart = this.id; slicesEnd = slice.id; } else { slicesStart = slice.id; slicesEnd = this.id; } List <SliceController> slices = timeline.GetSlices(slicesStart, slicesEnd - slicesStart + 1); RemoveLayer(layer); slice.AddLayer(layer, id); foreach (SliceController timelineSlice in slices) { timelineSlice.UpdateCache(); } if (Disowning != null) { Disowning.Invoke(this, new DisownEventArgs(layer, slice)); } foreach (SliceController timelineSlice in slices) { timelineSlice.UpdateUI(); timelineSlice.InvokeLocationChanged(new LocationChangeEventArgs(false, true)); } InvokeSizeChanged(); slice.InvokeSizeChanged(); }
internal void TransferItem(ItemController item, LayerController layer) { if (layer == this) { throw new ArgumentException("Layer can't be this layer."); } if (!items.Exists(x => x == item)) { throw new ArgumentException("This layer doesn't contain given item."); } RectangleProvider.InvalidateContentContainerRectangle(item.Rectangle); items.Remove(item); layer.items.Add(item); if (Disowning != null) { Disowning.Invoke(this, new DisownEventArgs(item, layer)); } RectangleProvider.InvalidateContentContainerRectangle(item.Rectangle); }