File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
invokeai/frontend/web/src/features/controlLayers/konva Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,14 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
296296 this . syncInteractionState ( ) ;
297297 } ;
298298
299+ syncCursorStyle = ( ) => {
300+ if ( ! this . parent . renderer . hasObjects ( ) ) {
301+ this . manager . stage . setCursor ( 'not-allowed' ) ;
302+ } else {
303+ this . manager . stage . setCursor ( 'default' ) ;
304+ }
305+ } ;
306+
299307 anchorStyleFunc = ( anchor : Konva . Rect ) : void => {
300308 // Give the rotater special styling
301309 if ( anchor . hasName ( 'rotater' ) ) {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
22import { CanvasModuleBase } from 'features/controlLayers/konva/CanvasModuleBase' ;
33import type { CanvasToolModule } from 'features/controlLayers/konva/CanvasTool/CanvasToolModule' ;
44import { getPrefixedId } from 'features/controlLayers/konva/util' ;
5- import { noop } from 'lodash-es' ;
65import type { Logger } from 'roarr' ;
76
87export class CanvasMoveToolModule extends CanvasModuleBase {
@@ -24,8 +23,13 @@ export class CanvasMoveToolModule extends CanvasModuleBase {
2423 this . log . debug ( 'Creating module' ) ;
2524 }
2625
27- /**
28- * This is a noop. Entity transformers handle cursor style when the move tool is active.
29- */
30- syncCursorStyle = noop ;
26+ syncCursorStyle = ( ) => {
27+ const selectedEntity = this . manager . stateApi . getSelectedEntityAdapter ( ) ;
28+ if ( ! selectedEntity ) {
29+ this . manager . stage . setCursor ( 'not-allowed' ) ;
30+ } else {
31+ // The cursor is on an entity, defer to transformer to handle the cursor
32+ selectedEntity . transformer . syncCursorStyle ( ) ;
33+ }
34+ } ;
3135}
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ export class CanvasToolModule extends CanvasModuleBase {
170170 } else if ( segmentingAdapter ) {
171171 segmentingAdapter . segmentAnything . syncCursorStyle ( ) ;
172172 } else if ( transformingAdapter ) {
173- // The transformer handles cursor style via events
173+ transformingAdapter . transformer . syncCursorStyle ( ) ;
174174 } else if ( this . manager . stateApi . $isFiltering . get ( ) ) {
175175 stage . setCursor ( 'not-allowed' ) ;
176176 } else if ( this . manager . stagingArea . $isStaging . get ( ) ) {
You can’t perform that action at this time.
0 commit comments