mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-24 13:38:34 +01:00
Compare commits
3 commits
d1fbcb9559
...
20e2d098ef
Author | SHA1 | Date | |
---|---|---|---|
20e2d098ef | |||
0dad4860c1 | |||
ed02a83879 |
1 changed files with 15 additions and 5 deletions
|
@ -15,7 +15,7 @@ namespace MLEM.Ui.Elements {
|
||||||
/// Additionally, a panel can be set to <see cref="scrollOverflow"/> on construction, which causes all elements that don't fit into the panel to be hidden until scrolled to using a <see cref="ScrollBar"/>.
|
/// Additionally, a panel can be set to <see cref="scrollOverflow"/> on construction, which causes all elements that don't fit into the panel to be hidden until scrolled to using a <see cref="ScrollBar"/>.
|
||||||
/// As this behavior is accomplished using a <see cref="RenderTarget2D"/>, scrolling panels need to have their <see cref="DrawEarly"/> methods called using <see cref="UiSystem.DrawEarly"/>.
|
/// As this behavior is accomplished using a <see cref="RenderTarget2D"/>, scrolling panels need to have their <see cref="DrawEarly"/> methods called using <see cref="UiSystem.DrawEarly"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Panel : Element {
|
public class Panel : Element, IDisposable {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The texture that this panel should have, or null if it should be invisible.
|
/// The texture that this panel should have, or null if it should be invisible.
|
||||||
|
@ -76,6 +76,10 @@ namespace MLEM.Ui.Elements {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~Panel() {
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ForceUpdateArea() {
|
public override void ForceUpdateArea() {
|
||||||
if (this.scrollOverflow) {
|
if (this.scrollOverflow) {
|
||||||
|
@ -178,13 +182,10 @@ namespace MLEM.Ui.Elements {
|
||||||
batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, null, null, null, trans);
|
batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, null, null, null, trans);
|
||||||
base.Draw(time, batch, alpha, blendState, samplerState, trans);
|
base.Draw(time, batch, alpha, blendState, samplerState, trans);
|
||||||
batch.End();
|
batch.End();
|
||||||
// also draw any children early within the render target with the translation applied
|
|
||||||
base.DrawEarly(time, batch, alpha, blendState, samplerState, trans);
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
base.DrawEarly(time, batch, alpha, blendState, samplerState, matrix);
|
base.DrawEarly(time, batch, alpha, blendState, samplerState, matrix);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Element GetElementUnderPos(Vector2 position) {
|
public override Element GetElementUnderPos(Vector2 position) {
|
||||||
|
@ -234,5 +235,14 @@ namespace MLEM.Ui.Elements {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Dispose() {
|
||||||
|
if (this.renderTarget != null) {
|
||||||
|
this.renderTarget.Dispose();
|
||||||
|
this.renderTarget = null;
|
||||||
|
}
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue