增加 Symbol,history 增加 isModified

This commit is contained in:
mario.gk 2020-05-07 21:38:47 +08:00
parent e5b7390dde
commit 984a76993f
3 changed files with 24 additions and 0 deletions

View File

@ -174,6 +174,10 @@ export class History {
this.emitter.removeAllListeners();
this.records = [];
}
isModified() {
return this.point !== this.session.cursor;
}
}
class Session {

View File

@ -25,6 +25,7 @@ import DragEngine from './drag-engine';
import Viewport from './viewport';
import Project from './project';
import { designer, editor } from './editor';
import Symbols from './symbols';
import './vision.less';
@ -109,6 +110,7 @@ const VisualEngine = {
Version,
Project,
logger,
Symbols,
};
(window as any).VisualEngine = VisualEngine;
@ -156,6 +158,7 @@ export {
Version,
Project,
logger,
Symbols,
};

View File

@ -0,0 +1,17 @@
export class SymbolManager {
private symbolMap: { [symbolName: string]: symbol } = {};
public create(name: string): symbol {
if (this.symbolMap[name]) {
return this.symbolMap[name];
}
this.symbolMap[name] = Symbol(name);
return this.symbolMap[name];
}
public get(name: string) {
return this.symbolMap[name];
}
}
export default new SymbolManager();