@@ -37,7 +37,7 @@ namespace Pinta.Core;
3737public abstract class BaseTool
3838{
3939 private readonly IToolService tools ;
40- private readonly IWorkspaceService workspace ;
40+ protected readonly IWorkspaceService workspace ;
4141
4242 protected IResourceService Resources { get ; }
4343 protected ISettingsService Settings { get ; }
@@ -55,11 +55,9 @@ protected BaseTool (IServiceProvider services)
5555 CurrentCursor = DefaultCursor ;
5656
5757 // Update cursor when active document changes
58- workspace . ActiveDocumentChanged += ( _ , _ ) => {
59- if ( tools . CurrentTool == this )
60- SetCursor ( CurrentCursor ) ;
61- } ;
62-
58+ workspace . ActiveDocumentChanged += ( _ , _ ) => RefreshCursorIfActive ( ) ;
59+ // Update cursor on zoom
60+ workspace . ViewSizeChanged += ( _ , _ ) => RefreshCursorIfActive ( ) ;
6361 // Give tools a chance to save their settings on application quit
6462 Settings . SaveSettingsBeforeQuit += ( _ , _ )
6563 => OnSaveSettings ( Settings ) ;
@@ -92,12 +90,6 @@ public virtual Cursor? DefaultCursor
9290 /// </summary>
9391 public Cursor ? CurrentCursor { get ; private set ; }
9492
95- /// <summary>
96- /// Specifies whether this application needs to update this tool's
97- /// cursor after a zoom operation.
98- /// </summary>
99- public virtual bool CursorChangesOnZoom
100- => false ;
10193
10294 /// <summary>
10395 /// Specifies whether the tool manipulates selections.
@@ -170,14 +162,6 @@ public virtual bool UseAlphaBlending {
170162 }
171163 }
172164
173- public virtual void OnCanvasZoom ( )
174- {
175- if ( CursorChangesOnZoom ) {
176- //The current tool's cursor changes when the zoom changes.
177- SetCursor ( DefaultCursor ) ;
178- }
179- }
180-
181165 /// <summary>
182166 /// Called when the tool is selected from the toolbox.
183167 /// </summary>
@@ -335,6 +319,18 @@ public void SetCursor (Cursor? cursor)
335319 workspace . ActiveWorkspace . Canvas . Cursor = cursor ;
336320 }
337321
322+ private void RefreshCursorIfActive ( )
323+ {
324+ if ( tools . CurrentTool == this ) {
325+ RefreshCursor ( ) ;
326+ }
327+ }
328+
329+ protected virtual void RefreshCursor ( )
330+ {
331+ SetCursor ( DefaultCursor ) ;
332+ }
333+
338334 #region Toolbar
339335 private ToolBoxButton ? tool_item ;
340336 private ToolBarDropDownButton ? antialiasing_button ;
0 commit comments