mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 14:38:34 +01:00
made scroll bars only work when the mouse is in their parent
This commit is contained in:
parent
4624219b4e
commit
75f7bbd2f9
1 changed files with 6 additions and 3 deletions
|
@ -43,10 +43,13 @@ namespace MLEM.Ui.Elements {
|
||||||
|
|
||||||
public override void Update(GameTime time) {
|
public override void Update(GameTime time) {
|
||||||
base.Update(time);
|
base.Update(time);
|
||||||
|
var moused = this.System.MousedElement;
|
||||||
|
if (moused == this.Parent || moused?.Parent == this.Parent) {
|
||||||
var scroll = this.Input.LastScrollWheel - this.Input.ScrollWheel;
|
var scroll = this.Input.LastScrollWheel - this.Input.ScrollWheel;
|
||||||
if (scroll != 0)
|
if (scroll != 0)
|
||||||
this.CurrentValue += this.StepPerScroll * Math.Sign(scroll);
|
this.CurrentValue += this.StepPerScroll * Math.Sign(scroll);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Draw(GameTime time, SpriteBatch batch, float alpha, Point offset) {
|
public override void Draw(GameTime time, SpriteBatch batch, float alpha, Point offset) {
|
||||||
batch.Draw(this.Background, this.DisplayArea.OffsetCopy(offset), Color.White * alpha, this.Scale);
|
batch.Draw(this.Background, this.DisplayArea.OffsetCopy(offset), Color.White * alpha, this.Scale);
|
||||||
|
|
Loading…
Reference in a new issue