File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 33 * @Author : 秦少卫
44 * @Date : 2023-06-20 13:06:31
55 * @LastEditors : 秦少卫
6- * @LastEditTime : 2024-04-10 17:33:25
6+ * @LastEditTime : 2024-04-17 12:26:45
77 * @Description : 历史记录插件
88 */
99import { fabric } from 'fabric' ;
@@ -30,12 +30,13 @@ class HistoryPlugin {
3030 this . canvas = canvas ;
3131 this . editor = editor ;
3232 this . _init ( ) ;
33+
34+ fabric . Canvas . prototype . _historyNext = ( ) => {
35+ return this . editor . getJson ( ) ;
36+ } ;
3337 }
3438
3539 _init ( ) {
36- this . canvas . getObjects ( ) . forEach ( ( item ) => {
37- this . canvas . add ( item ) ;
38- } ) ;
3940 this . canvas . on ( 'history:append' , ( ) => {
4041 this . historyUpdate ( ) ;
4142 } ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ declare namespace fabric {
66 isDragging : boolean ;
77 _currentTransform : unknown ;
88 clearHistory ( ) : void ;
9+ _historyNext ( ) : void ;
910 _centerObject : ( obj : fabric . Object , center : fabric . Point ) => fabric . Canvas ;
1011 _setupCurrentTransform ( e : Event , target : fabric . Object , alreadySelected : boolean ) : void ;
1112 }
You can’t perform that action at this time.
0 commit comments