@@ -33,6 +33,10 @@ export interface INodeSetPositionOptions {
33
33
isNotifySkipped : boolean ;
34
34
}
35
35
36
+ export interface INodeSetStyleOptions {
37
+ isNotifySkipped : boolean ;
38
+ }
39
+
36
40
export enum NodeShapeType {
37
41
CIRCLE = 'circle' ,
38
42
DOT = 'dot' ,
@@ -117,10 +121,10 @@ export interface INode<N extends INodeBase, E extends IEdgeBase> extends ISubjec
117
121
callback : ( node : INode < N , E > ) => INodeCoordinates | INodePosition ,
118
122
options ?: INodeSetPositionOptions ,
119
123
) : void ;
120
- setStyle ( style : INodeStyle ) : void ;
121
- setStyle ( callback : ( node : INode < N , E > ) => INodeStyle ) : void ;
122
- patchStyle ( style : INodeStyle ) : void ;
123
- patchStyle ( callback : ( node : INode < N , E > ) => INodeStyle ) : void ;
124
+ setStyle ( style : INodeStyle , options ?: INodeSetPositionOptions ) : void ;
125
+ setStyle ( callback : ( node : INode < N , E > ) => INodeStyle , options ?: INodeSetPositionOptions ) : void ;
126
+ patchStyle ( style : INodeStyle , options ?: INodeSetPositionOptions ) : void ;
127
+ patchStyle ( callback : ( node : INode < N , E > ) => INodeStyle , options ?: INodeSetPositionOptions ) : void ;
124
128
setState ( state : number ) : void ;
125
129
setState ( state : IGraphObjectStateParameters ) : void ;
126
130
setState ( callback : ( node : INode < N , E > ) => number ) : void ;
@@ -478,20 +482,22 @@ export class Node<N extends INodeBase, E extends IEdgeBase> extends Subject impl
478
482
}
479
483
}
480
484
481
- setStyle ( style : INodeStyle ) : void ;
482
- setStyle ( callback : ( node : INode < N , E > ) => INodeStyle ) : void ;
483
- setStyle ( arg : INodeStyle | ( ( node : INode < N , E > ) => INodeStyle ) ) : void {
485
+ setStyle ( style : INodeStyle , options ?: INodeSetPositionOptions ) : void ;
486
+ setStyle ( callback : ( node : INode < N , E > ) => INodeStyle , options ?: INodeSetPositionOptions ) : void ;
487
+ setStyle ( arg : INodeStyle | ( ( node : INode < N , E > ) => INodeStyle ) , options ?: INodeSetPositionOptions ) : void {
484
488
if ( isFunction ( arg ) ) {
485
489
this . _style = ( arg as ( node : INode < N , E > ) => INodeStyle ) ( this ) ;
486
490
} else {
487
491
this . _style = arg as INodeStyle ;
488
492
}
489
- this . notifyListeners ( ) ;
493
+ if ( ! options ?. isNotifySkipped ) {
494
+ this . notifyListeners ( ) ;
495
+ }
490
496
}
491
497
492
- patchStyle ( style : INodeStyle ) : void ;
493
- patchStyle ( callback : ( node : INode < N , E > ) => INodeStyle ) : void ;
494
- patchStyle ( arg : INodeStyle | ( ( node : INode < N , E > ) => INodeStyle ) ) {
498
+ patchStyle ( style : INodeStyle , options ?: INodeSetPositionOptions ) : void ;
499
+ patchStyle ( callback : ( node : INode < N , E > ) => INodeStyle , options ?: INodeSetPositionOptions ) : void ;
500
+ patchStyle ( arg : INodeStyle | ( ( node : INode < N , E > ) => INodeStyle ) , options ?: INodeSetPositionOptions ) {
495
501
let style : INodeStyle ;
496
502
497
503
if ( isFunction ( arg ) ) {
@@ -502,7 +508,9 @@ export class Node<N extends INodeBase, E extends IEdgeBase> extends Subject impl
502
508
503
509
patchProperties ( this . _style , style ) ;
504
510
505
- this . notifyListeners ( ) ;
511
+ if ( ! options ?. isNotifySkipped ) {
512
+ this . notifyListeners ( ) ;
513
+ }
506
514
}
507
515
508
516
setState ( state : number ) : void ;
0 commit comments