private void DragHandler_OnDraggableRegionsChanged(object sender, Chromium.Event.CfxOnDraggableRegionsChangedEventArgs args) { _DraggableRegion = args.Regions.Aggregate(_DraggableRegion, (current, region) => { var rect = new Rectangle(region.Bounds.X, region.Bounds.Y, region.Bounds.Width, region.Bounds.Height); if (current == null) { return(new Region(rect)); } if (region.Draggable) { current.Union(rect); } else { current.Exclude(rect); } return(current); }); _Rectange = args.Regions.Select(r => r.Bounds).Aggregate(_Rectange, (current, bounds) => new Rectangle(0, 0, Math.Max(current.X + current.Size.Width, bounds.X + bounds.Width), Math.Max(current.Y + current.Size.Height, bounds.X + bounds.Height)) ); }
private void DragHandler_OnDraggableRegionsChanged(object sender, Chromium.Event.CfxOnDraggableRegionsChangedEventArgs args) { _DraggableRegion = args.Regions.Aggregate(new Region(), (current, region) => { var rect = new Rectangle(region.Bounds.X, region.Bounds.Y, region.Bounds.Width, region.Bounds.Height); if (region.Draggable) { current.Union(rect); } else { current.Exclude(rect); } return(current); }); _DraggableRegion.Transform(_Matrix); }