@@ -9,8 +9,8 @@ public abstract class AttachedPanel {
99 protected float width ;
1010 protected virtual SchemeColor background => SchemeColor . PureBackground ;
1111
12- protected AttachedPanel ( Padding padding , float width , InputSystem inputSystem ) {
13- contents = new ImGui ( BuildContents , padding , inputSystem ) { boxColor = background , boxShadow = RectangleBorder . Thin } ;
12+ protected AttachedPanel ( Padding padding , float width ) {
13+ contents = new ImGui ( BuildContents , padding ) { boxColor = background , boxShadow = RectangleBorder . Thin } ;
1414 this . width = width ;
1515 }
1616
@@ -49,13 +49,13 @@ public void Build(ImGui gui) {
4949 protected abstract void BuildContents ( ImGui gui ) ;
5050 }
5151
52- public abstract class DropDownPanel ( Padding padding , float width , InputSystem inputSystem ) : AttachedPanel ( padding , width , inputSystem ) , IMouseFocus {
52+ public abstract class DropDownPanel : AttachedPanel , IMouseFocus {
5353 private bool focused ;
54-
54+ protected DropDownPanel ( Padding padding , float width ) : base ( padding , width ) { }
5555 protected override bool ShouldBuild ( ImGui source , Rect sourceRect , ImGui parent , Rect parentRect ) => focused ;
5656
5757 public override void SetFocus ( ImGui source , Rect rect ) {
58- source . inputSystem . SetMouseFocus ( this ) ;
58+ InputSystem . Instance . SetMouseFocus ( this ) ;
5959 base . SetFocus ( source , rect ) ;
6060 }
6161
@@ -80,7 +80,7 @@ public void FocusChanged(bool focused) {
8080 public class SimpleDropDown : DropDownPanel {
8181 private GuiBuilder ? builder ;
8282
83- public SimpleDropDown ( InputSystem inputSystem ) : base ( new Padding ( 1f ) , 20f , inputSystem ) => contents . AddMessageHandler < ImGuiUtils . CloseDropdownEvent > ( HandleDropdownClosed ) ;
83+ public SimpleDropDown ( ) : base ( new Padding ( 1f ) , 20f ) => contents . AddMessageHandler < ImGuiUtils . CloseDropdownEvent > ( HandleDropdownClosed ) ;
8484
8585 private bool HandleDropdownClosed ( ImGuiUtils . CloseDropdownEvent _ ) {
8686 Close ( ) ;
@@ -118,15 +118,10 @@ protected override void BuildContents(ImGui gui) {
118118 }
119119
120120 public abstract class Tooltip : AttachedPanel {
121- private readonly InputSystem inputSystem ;
122- protected Tooltip ( Padding padding , float width , InputSystem inputSystem ) : base ( padding , width , inputSystem ) {
123- contents . mouseCapture = false ;
124- this . inputSystem = inputSystem ;
125- }
126-
121+ protected Tooltip ( Padding padding , float width ) : base ( padding , width ) => contents . mouseCapture = false ;
127122 protected override bool ShouldBuild ( ImGui source , Rect sourceRect , ImGui parent , Rect parentRect ) {
128123 var window = source . window ;
129- if ( inputSystem . mouseOverWindow != window ) {
124+ if ( InputSystem . Instance . mouseOverWindow != window ) {
130125 return false ;
131126 }
132127
@@ -148,14 +143,16 @@ protected override Vector2 CalculatePosition(ImGui gui, Rect targetRect, Vector2
148143 }
149144 }
150145
151- public class SimpleTooltip ( InputSystem inputSystem ) : Tooltip ( new Padding ( 0.5f ) , 30f , inputSystem ) {
146+ public class SimpleTooltip : Tooltip {
152147 private GuiBuilder ? builder ;
153148 public void Show ( GuiBuilder builder , ImGui gui , Rect rect , float width = 30f ) {
154149 this . width = width ;
155150 this . builder = builder ;
156151 base . SetFocus ( gui , rect ) ;
157152 }
158153
154+ public SimpleTooltip ( ) : base ( new Padding ( 0.5f ) , 30f ) { }
155+
159156 protected override void BuildContents ( ImGui gui ) {
160157 gui . boxColor = SchemeColor . PureBackground ;
161158 gui . textColor = SchemeColor . BackgroundText ;
0 commit comments