plot-plan-designer
Version:
Design Editor Tools with React.js + ant.design + fabric.js
26 lines (25 loc) • 710 B
JavaScript
import { fabric } from 'fabric';
const Port = fabric.util.createClass(fabric.Rect, {
type: 'port',
superType: 'port',
initialize(options) {
options = options || {};
this.callSuper('initialize', options);
},
toObject() {
return fabric.util.object.extend(this.callSuper('toObject'), {
id: this.get('id'),
superType: this.get('superType'),
enabled: this.get('enabled'),
nodeId: this.get('nodeId'),
});
},
_render(ctx) {
this.callSuper('_render', ctx);
},
});
Port.fromObject = (options, callback) => {
return callback(new Port(options));
};
window.fabric.Port = Port;
export default Port;