File tree Expand file tree Collapse file tree 6 files changed +48
-7
lines changed
invokeai/frontend/web/src/features/controlLayers/konva Expand file tree Collapse file tree 6 files changed +48
-7
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,10 @@ export abstract class CanvasEntityAdapterBase<
285285 this . subscriptions . add (
286286 this . manager . stateApi . createStoreSubscription ( selectIsolatedLayerPreview , this . syncVisibility )
287287 ) ;
288+ this . subscriptions . add (
289+ this . manager . stateApi . createStoreSubscription ( selectIsolatedStagingPreview , this . syncVisibility )
290+ ) ;
291+ this . subscriptions . add ( this . manager . stateApi . createStoreSubscription ( selectIsStaging , this . syncVisibility ) ) ;
288292 this . subscriptions . add ( this . manager . stateApi . $filteringAdapter . listen ( this . syncVisibility ) ) ;
289293 this . subscriptions . add ( this . manager . stateApi . $transformingAdapter . listen ( this . syncVisibility ) ) ;
290294 this . subscriptions . add ( this . manager . stateApi . $segmentingAdapter . listen ( this . syncVisibility ) ) ;
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' ) ) {
@@ -591,6 +599,13 @@ export class CanvasEntityTransformer extends CanvasModuleBase {
591599 syncInteractionState = ( ) => {
592600 this . log . trace ( 'Syncing interaction state' ) ;
593601
602+ if ( this . manager . stagingArea . $isStaging . get ( ) ) {
603+ // While staging, the layer should not be interactable
604+ this . parent . konva . layer . listening ( false ) ;
605+ this . _setInteractionMode ( 'off' ) ;
606+ return ;
607+ }
608+
594609 if ( this . parent . segmentAnything ?. $isSegmenting . get ( ) ) {
595610 // When segmenting, the layer should listen but the transformer should not be interactable
596611 this . parent . konva . layer . listening ( true ) ;
Original file line number Diff line number Diff line change @@ -59,7 +59,9 @@ export class CanvasProgressImageModule extends CanvasModuleBase {
5959 this . hasActiveGeneration = true ;
6060 } else {
6161 this . hasActiveGeneration = false ;
62- this . $lastProgressEvent . set ( null ) ;
62+ if ( ! this . manager . stagingArea . $isStaging . get ( ) ) {
63+ this . $lastProgressEvent . set ( null ) ;
64+ }
6365 }
6466 } )
6567 ) ;
Original file line number Diff line number Diff line change @@ -680,4 +680,20 @@ export class CanvasStateApiModule extends CanvasModuleBase {
680680 * Whether the shift key is currently pressed.
681681 */
682682 $shiftKey = $shift ;
683+
684+ repr = ( ) => {
685+ return {
686+ id : this . id ,
687+ type : this . type ,
688+ path : this . path ,
689+ $filteringAdapter : this . $filteringAdapter . get ( ) ?. entityIdentifier ,
690+ $isFiltering : this . $isFiltering . get ( ) ,
691+ $transformingAdapter : this . $transformingAdapter . get ( ) ?. entityIdentifier ,
692+ $isTransforming : this . $isTransforming . get ( ) ,
693+ $rasterizingAdapter : this . $rasterizingAdapter . get ( ) ?. entityIdentifier ,
694+ $isRasterizing : this . $isRasterizing . get ( ) ,
695+ $segmentingAdapter : this . $segmentingAdapter . get ( ) ?. entityIdentifier ,
696+ $isSegmenting : this . $isSegmenting . get ( ) ,
697+ } ;
698+ } ;
683699}
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