Exemple #1
0
        public static void AlignByGrid(this vMixController.Widgets.vMixControl item)
        {
            var pleft = item.Left;

            item.Left = ((int)item.Left / 8) * 8;
            if (pleft > 0)
            {
                item.Width += pleft - item.Left;
            }
            item.Width  = ((int)item.Width / 8) * 8;
            item.Height = ((int)item.Height / 8) * 8;
            item.Top    = ((int)item.Top / 8) * 8;

            //Avoid widget to be unreachable
            if (item.Top < 0)
            {
                item.Top = 0;
            }
            if (item.Left < 0)
            {
                item.Left = 0;
            }
            if (item.Height < 8)
            {
                item.Height = 8;
            }
        }
        private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e)
        {
            vMixController.Widgets.vMixControl item = this.DataContext as vMixController.Widgets.vMixControl;

            if (item != null && !item.Locked)
            {
                double deltaHorizontal = 0;

                switch (HorizontalAlignment)
                {
                case System.Windows.HorizontalAlignment.Right:

                    deltaHorizontal = Math.Min(-e.HorizontalChange, item.Width - 64);
                    item.Width     -= deltaHorizontal;
                    item.AlignByGrid();
                    break;

                case System.Windows.HorizontalAlignment.Left:
                    deltaHorizontal = Math.Min(e.HorizontalChange, item.Width - 64);
                    item.Width     -= deltaHorizontal;
                    item.Left      += deltaHorizontal;
                    item.AlignByGrid();
                    break;

                default:
                    break;
                }
            }

            e.Handled = true;
        }
Exemple #3
0
        public static void AlignByGrid(this vMixController.Widgets.vMixControl item)
        {
            var pleft = item.Left;

            item.Left = ((int)item.Left / 8) * 8;
            if (pleft > 0)
            {
                item.Width += pleft - item.Left;
            }
            item.Width = ((int)item.Width / 8) * 8;
            item.Top   = ((int)item.Top / 8) * 8;
        }