@@ -85,13 +85,7 @@ class Sidebar {
8585 const controlsY = GameConfig . SIDEBAR_CONTROLS_Y + 25 ;
8686
8787 // Left click control
88- this . leftClickIcon = this . scene . add . graphics ( ) ;
89- this . leftClickIcon . fillStyle ( 0x94a3b8 , 1 ) ; // Light gray for mouse body
90- this . leftClickIcon . fillRoundedRect ( GameConfig . SIDEBAR_MARGIN , controlsY , 18 , 20 , 3 ) ;
91- this . leftClickIcon . fillStyle ( 0x64b5f6 , 1 ) ; // Accent blue for left button
92- this . leftClickIcon . fillRect ( GameConfig . SIDEBAR_MARGIN + 2 , controlsY + 2 , 7 , 10 ) ;
93- this . leftClickIcon . lineStyle ( 1 , 0x2196f3 , 1 ) ; // Blue border
94- this . leftClickIcon . strokeRect ( GameConfig . SIDEBAR_MARGIN + 2 , controlsY + 2 , 7 , 10 ) ;
88+ this . leftClickIcon = this . createMouseButton ( controlsY , true ) ;
9589 this . elements . push ( this . leftClickIcon ) ;
9690
9791 this . leftClickText = this . scene . add . text (
@@ -104,13 +98,7 @@ class Sidebar {
10498
10599 // Right click control
106100 const rightClickY = controlsY + 30 ;
107- this . rightClickIcon = this . scene . add . graphics ( ) ;
108- this . rightClickIcon . fillStyle ( 0x94a3b8 , 1 ) ; // Light gray for mouse body
109- this . rightClickIcon . fillRoundedRect ( GameConfig . SIDEBAR_MARGIN , rightClickY , 18 , 20 , 3 ) ;
110- this . rightClickIcon . fillStyle ( 0x64b5f6 , 1 ) ; // Accent blue for right button
111- this . rightClickIcon . fillRect ( GameConfig . SIDEBAR_MARGIN + 9 , rightClickY + 2 , 7 , 10 ) ;
112- this . rightClickIcon . lineStyle ( 1 , 0x2196f3 , 1 ) ; // Blue border
113- this . rightClickIcon . strokeRect ( GameConfig . SIDEBAR_MARGIN + 9 , rightClickY + 2 , 7 , 10 ) ;
101+ this . rightClickIcon = this . createMouseButton ( rightClickY , false ) ;
114102 this . elements . push ( this . rightClickIcon ) ;
115103
116104 this . rightClickText = this . scene . add . text (
@@ -122,7 +110,19 @@ class Sidebar {
122110 this . elements . push ( this . rightClickText ) ;
123111 }
124112
125-
113+ createMouseButton ( yPosition , isLeftButton ) {
114+ const mouseIcon = this . scene . add . graphics ( ) ;
115+ mouseIcon . fillStyle ( 0x94a3b8 , 1 ) ; // Light gray for mouse body
116+ mouseIcon . fillRoundedRect ( GameConfig . SIDEBAR_MARGIN , yPosition , 18 , 20 , 3 ) ;
117+ mouseIcon . fillStyle ( 0x64b5f6 , 1 ) ; // Accent blue for active button
118+
119+ const buttonX = isLeftButton ? GameConfig . SIDEBAR_MARGIN + 2 : GameConfig . SIDEBAR_MARGIN + 9 ;
120+ mouseIcon . fillRect ( buttonX , yPosition + 2 , 7 , 10 ) ;
121+ mouseIcon . lineStyle ( 1 , 0x2196f3 , 1 ) ; // Blue border
122+ mouseIcon . strokeRect ( buttonX , yPosition + 2 , 7 , 10 ) ;
123+
124+ return mouseIcon ;
125+ }
126126
127127 updatePlayer ( _player )
128128 {
0 commit comments