Skip to content

Commit

Permalink
Stop all mouse inputs from propagating beyond panel header
Browse files Browse the repository at this point in the history
  • Loading branch information
sliekens committed Jan 18, 2025
1 parent d78b3b3 commit a6fca31
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Blish HUD/Controls/Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Newtonsoft.Json;
using System;
using System.ComponentModel;
using Microsoft.Xna.Framework.Input;

namespace Blish_HUD.Controls {

Expand Down Expand Up @@ -144,17 +145,22 @@ public void NavigateToBuiltPanel(BuildUIDelegate buildCall, object obj) {

/// <inheritdoc />
protected override void OnClick(MouseEventArgs e) {
if (!string.IsNullOrEmpty(_title) && _layoutHeaderBounds.Contains(this.RelativeMousePosition)) {
if (_canCollapse) {
this.ToggleAccordionState();
}

e.StopPropagation();
if (_canCollapse && _layoutHeaderBounds.Contains(this.RelativeMousePosition)) {
this.ToggleAccordionState();
}

base.OnClick(e);
}

/// <inheritdoc />
public override Control TriggerMouseInput(MouseEventArgs args, MouseState ms) {
if (!string.IsNullOrEmpty(_title) && _layoutHeaderBounds.Contains(this.RelativeMousePosition)) {
args.StopPropagation();
}

return base.TriggerMouseInput(args, ms);
}

protected override void OnChildAdded(ChildChangedEventArgs e) {
base.OnChildAdded(e);

Expand Down

0 comments on commit a6fca31

Please sign in to comment.