1616using Intersect . Logging ;
1717using Microsoft . Xna . Framework . Graphics ;
1818using WeifenLuo . WinFormsUI . Docking ;
19- using Timer = System . Windows . Forms . Timer ;
2019
2120namespace Intersect . Editor . Forms . DockingElements ;
2221
@@ -36,9 +35,6 @@ public partial class FrmMapEditor : DockContent
3635
3736 private bool mMapChanged ;
3837
39- // MapGrid Cursor
40- private Timer cursorUpdateTimer ;
41-
4238 public struct IconInfo
4339 {
4440 public bool FIcon ;
@@ -68,11 +64,13 @@ public FrmMapEditor()
6864 InitializeComponent ( ) ;
6965 Icon = Program . Icon ;
7066 picMap . MouseLeave += ( _sender , _args ) => tooltipMapAttribute ? . Hide ( ) ;
71- // Initialize cursor timer
72- cursorUpdateTimer = new Timer ( ) ;
73- cursorUpdateTimer . Interval = 200 ;
74- cursorUpdateTimer . Tick += CursorUpdateTimer_Tick ;
75- cursorUpdateTimer . Start ( ) ;
67+
68+ Globals . ToolChanged += Globals_ToolChanged ;
69+ }
70+
71+ private void Globals_ToolChanged ( object ? sender , EventArgs e )
72+ {
73+ SetCursorSpriteInGrid ( ) ;
7674 }
7775
7876 private void InitLocalization ( )
@@ -2348,30 +2346,24 @@ private void pnlMapContainer_Resize(object sender, EventArgs e)
23482346
23492347 private void picMap_MouseEnter ( object sender , EventArgs e )
23502348 {
2351- if ( ! Globals . MapEditorWindow . DockPanel . Focused && Globals . CurrentEditor == - 1 )
2349+ if ( Globals . EditingLight != null || Globals . CurrentEditor != - 1 )
2350+ {
2351+ RemoveSpriteCursorInGrid ( ) ;
2352+ return ;
2353+ }
2354+
2355+ if ( ! Globals . MapEditorWindow . DockPanel . Focused )
23522356 {
23532357 Globals . MapEditorWindow . DockPanel . Focus ( ) ;
23542358 }
23552359
2356- RemoveSpriteCursorInGrid ( ) ;
2360+ SetCursorSpriteInGrid ( ) ;
23572361 }
2358-
23592362 private void picMap_MouseLeave ( object sender , EventArgs e )
23602363 {
23612364 RemoveSpriteCursorInGrid ( ) ;
23622365 }
23632366
2364- private void CursorUpdateTimer_Tick ( object sender , EventArgs e )
2365- {
2366- if ( Globals . EditingLight != null || Globals . CurrentEditor != - 1 ||
2367- ! Globals . MapEditorWindow . DockPanel . Focused )
2368- {
2369- return ;
2370- }
2371-
2372- SetCursorSpriteInGrid ( ) ;
2373- }
2374-
23752367 private void SetCursorSpriteInGrid ( )
23762368 {
23772369 if ( ! Preferences . EnableCursorSprites )
0 commit comments