2019-05-01 11:44:26 +08:00

48 lines
851 B
JavaScript

var ID = -1;
/**
* 所有可视化组件基类
* @author tengge / https://github.com/tengge1
*/
function BaseComponent() {
this.id = `VisualComponent${ID--}`;
this.type = 'VisualComponent'; // 根据此字段判断类型,进行反序列化
}
/**
* 实现该函数,可以在编辑器中拖动该控件。
* 原型:setTranslate(dx, dy)
*/
BaseComponent.prototype.setTranslate = null;
/**
* 渲染组件
* @param {SVGElement} parent 父组件
*/
BaseComponent.prototype.render = function (parent) {
};
/**
* 组件转json
*/
BaseComponent.prototype.toJSON = function () {
};
/**
* json转组件
* @param {Object} json JSON字符串反序列化后的对象
*/
BaseComponent.prototype.fromJSON = function (json) {
};
/**
* 清空组件
*/
BaseComponent.prototype.clear = function () {
};
export default BaseComponent;