1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Fix border being the wrong size

This commit is contained in:
smoogipoo 2018-02-23 15:29:56 +09:00
parent d72290ee24
commit 278b25bcbd
3 changed files with 59 additions and 25 deletions

View File

@ -4,14 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit.Layers;
using osu.Game.Rulesets.Edit.Layers.Selection;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.UI;
@ -50,17 +49,26 @@ namespace osu.Game.Rulesets.Edit
return;
}
ScalableContainer createLayerContainerWithContent(params Drawable[] content)
{
var container = CreateLayerContainer();
container.Children = content;
layerContainers.Add(container);
return container;
}
HitObjectOverlayLayer hitObjectOverlayLayer = CreateHitObjectOverlayLayer();
SelectionLayer selectionLayer = new SelectionLayer(rulesetContainer.Playfield);
var layerBelowRuleset = new BorderLayer
{
RelativeSizeAxes = Axes.Both,
Child = CreateLayerContainer()
};
var layerAboveRuleset = CreateLayerContainer();
layerAboveRuleset.Children = new Drawable[]
{
selectionLayer, // Below object overlays for input
hitObjectOverlayLayer,
selectionLayer.CreateProxy() // Proxy above object overlays for selections
};
layerContainers.Add(layerBelowRuleset);
layerContainers.Add(layerAboveRuleset);
RadioButtonCollection toolboxCollection;
InternalChild = new GridContainer
{
@ -85,22 +93,9 @@ namespace osu.Game.Rulesets.Edit
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
createLayerContainerWithContent(new Container
{
Name = "Border",
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderColour = Color4.White,
BorderThickness = 2,
Child = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true }
}),
layerBelowRuleset,
rulesetContainer,
createLayerContainerWithContent
(
selectionLayer, // Below object overlays for input
hitObjectOverlayLayer,
selectionLayer.CreateProxy() // Proxy above object overlays for selections
)
layerAboveRuleset
}
}
},

View File

@ -0,0 +1,38 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Edit.Layers
{
public class BorderLayer : Container
{
protected override Container<Drawable> Content => content;
private readonly Container content;
public BorderLayer()
{
InternalChildren = new Drawable[]
{
new Container
{
Name = "Border",
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderColour = Color4.White,
BorderThickness = 2,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
}
},
content = new Container { RelativeSizeAxes = Axes.Both }
};
}
}
}

View File

@ -348,6 +348,7 @@
<Compile Include="Overlays\Settings\Sections\Maintenance\DeleteAllBeatmapsDialog.cs" />
<Compile Include="Rulesets\Configuration\IRulesetConfigManager.cs" />
<Compile Include="Rulesets\Configuration\RulesetConfigManager.cs" />
<Compile Include="Rulesets\Edit\Layers\BorderLayer.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\CaptureBox.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\HitObjectOverlay.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\HitObjectOverlayLayer.cs" />