File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
import G6 from '@antv/g6' ;
2
2
import insertCss from 'insert-css' ;
3
+ import throttle from 'lodash.throttle' ;
3
4
/**
4
5
* @private
5
6
* @class G6Render
@@ -132,10 +133,8 @@ export class G6Render {
132
133
_getGraphConfig ( config ) {
133
134
const animateConfig = {
134
135
speed : 120 ,
135
- maxIteration : 83 ,
136
- tick : ( ) => {
137
- this . refreshPositions ( ) ;
138
- }
136
+ maxIteration : 120 ,
137
+ tick : throttle ( this . refreshPositions . bind ( this ) , 120 )
139
138
} ;
140
139
const defaultLayout = {
141
140
type : 'fruchterman' ,
Original file line number Diff line number Diff line change 27
27
"lodash.topairs" : " 4.3.0" ,
28
28
"lodash.uniqby" : " ^4.7.0" ,
29
29
"lodash.clonedeep" : " ^4.5.0" ,
30
+ "lodash.throttle" : " ^4.1.1" ,
30
31
"mapv" : " 2.0.62" ,
31
32
"node-forge" : " ^1.3.1" ,
32
33
"rbush" : " ^2.0.2" ,
Original file line number Diff line number Diff line change @@ -537,6 +537,18 @@ describe('KnowledgeGraph', () => {
537
537
var graph = new KnowledgeGraph ( { nodeLabelMaxWidth : 100 , animate : false } ) ;
538
538
expect ( graph ) . not . toBeNull ( ) ;
539
539
expect ( graph . data ) . not . toBeNull ( ) ;
540
+ expect ( graph . config . layout . tick ) . toBeUndefined ( ) ;
541
+ expect ( graph . config . layout . maxIteration ) . toBeUndefined ( ) ;
542
+ expect ( graph . config . layout . speed ) . toBeUndefined ( ) ;
543
+ done ( ) ;
544
+ } ) ;
545
+ it ( 'nodeLabelMaxWidth animate true' , ( done ) => {
546
+ var graph = new KnowledgeGraph ( { animate : true } ) ;
547
+ expect ( graph ) . not . toBeNull ( ) ;
548
+ expect ( graph . data ) . not . toBeNull ( ) ;
549
+ expect ( graph . config . layout . tick ) . not . toBeUndefined ( ) ;
550
+ expect ( graph . config . layout . maxIteration ) . not . toBeUndefined ( ) ;
551
+ expect ( graph . config . layout . speed ) . not . toBeUndefined ( ) ;
540
552
done ( ) ;
541
553
} ) ;
542
554
it ( 'expand collpase hidden Nodes' , ( done ) => {
You can’t perform that action at this time.
0 commit comments