File tree 3 files changed +14
-0
lines changed
3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 45
45
< button onClick ="focusOn() "> 定位到五角星</ button >
46
46
< button id ="undo " onClick ="undo() " disabled > 上一步</ button >
47
47
< button id ="redo " onClick ="redo() " disabled > 下一步</ button >
48
+ < button id ="clearData " onClick ="clearData() "> 清空数据</ button >
48
49
</ div >
49
50
< div id ="app "> </ div >
50
51
< div id ="debug "> </ div >
103
104
window . redo = function redo ( ) {
104
105
lf . redo ( )
105
106
}
107
+ window . clearData = function clearData ( ) {
108
+ lf . clearData ( )
109
+ }
106
110
window . consolelog = function consolelog ( msg ) {
107
111
console . log ( msg )
108
112
}
Original file line number Diff line number Diff line change @@ -635,6 +635,10 @@ export default class LogicFlow {
635
635
this . snaplineModel . clearSnapline ( ) ;
636
636
}
637
637
}
638
+ // 清空数据
639
+ clearData ( ) {
640
+ this . graphModel . clearData ( ) ;
641
+ }
638
642
/**
639
643
* 获取边的model
640
644
* @param edgeId 边的Id
Original file line number Diff line number Diff line change @@ -599,6 +599,12 @@ class GraphModel {
599
599
@action setTheme ( style : Style ) {
600
600
this . theme = updateTheme ( { ...this . theme , ...style } ) ;
601
601
}
602
+ // 清空数据
603
+ @action
604
+ clearData ( ) : void {
605
+ this . nodes = [ ] ;
606
+ this . edges = [ ] ;
607
+ }
602
608
}
603
609
604
610
export { GraphModel } ;
You can’t perform that action at this time.
0 commit comments