示例#1
0
        public ZoomSetting(FullCanvas canvas)
        {
            Canvas = canvas;

            var slider = new HandleSlider()
            {
                RelativeSizeAxes = Axes.Both
            };

            slider.Current = new BindableInt()
            {
                MinValue = 0, MaxValue = 100
            };
            slider.Current.ValueChanged += HandleValueChanged;
            slider.Current.Value         = 0;

            InternalChild = slider;
            Width         = 100;

            canvas.Zoom.ValueChanged += e =>
            {
                slider.Current.ValueChanged -= HandleValueChanged;
                slider.Current.Value         = (int)(e.NewValue * 10) - 10;
                slider.Current.ValueChanged += HandleValueChanged;
            };
        }
示例#2
0
        public ToolSettingsPanel(FullCanvas fcanvas)
        {
            var canvas = fcanvas.Canvas;

            Container = new FillFlowContainer();
            Container.RelativeSizeAxes = Axes.Both;
            Container.Direction        = FillDirection.Horizontal;
            Container.Padding          = new MarginPadding()
            {
                Horizontal = 10, Vertical = 3
            };
            Container.Spacing = new osuTK.Vector2(10, 0);

            var tools = Enumerable.Empty <Drawable>()
                        .Append(new ZoomSetting(fcanvas))
                        .Append(new ThicknessToolSetting(canvas))
                        .Select(x => { x.RelativeSizeAxes = Axes.Y; return(x); });

            Container.AddRange(tools);

            canvas.CurrentToolBindable.ValueChanged += e =>
            {
                foreach (var child in Container.Children.OfType <ToolSettingBase>())
                {
                    child.Alpha = child.AppliesTo(e.NewValue) ? 1 : 0;
                }
            };

            InternalChildren = new Drawable[]
            {
                new Box()
                {
                    Colour = Colors.Background, RelativeSizeAxes = Axes.Both
                },
                Container
            };
        }