93 lines
3.0 KiB
JavaScript
93 lines
3.0 KiB
JavaScript
![]() |
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|||
|
|
|||
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|||
|
|
|||
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|||
|
|
|||
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|||
|
|
|||
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|||
|
|
|||
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|||
|
|
|||
|
var Base = require('./base');
|
|||
|
|
|||
|
var Component = /*#__PURE__*/function (_Base) {
|
|||
|
_inheritsLoose(Component, _Base);
|
|||
|
|
|||
|
var _super = _createSuper(Component);
|
|||
|
|
|||
|
function Component() {
|
|||
|
return _Base.apply(this, arguments) || this;
|
|||
|
}
|
|||
|
|
|||
|
var _proto = Component.prototype;
|
|||
|
|
|||
|
// 配置
|
|||
|
_proto.getDefaultCfg = function getDefaultCfg() {
|
|||
|
return {
|
|||
|
// 顶层标志位
|
|||
|
_id: null,
|
|||
|
// 用于动画
|
|||
|
// 容器
|
|||
|
canvas: null,
|
|||
|
container: null,
|
|||
|
// html,可选
|
|||
|
group: null,
|
|||
|
// G Group,可选
|
|||
|
// 交互属性
|
|||
|
capture: false,
|
|||
|
// props
|
|||
|
coord: null,
|
|||
|
offset: [0, 0],
|
|||
|
plotRange: null,
|
|||
|
// BBox
|
|||
|
position: [0, 0],
|
|||
|
visible: true,
|
|||
|
zIndex: 1
|
|||
|
};
|
|||
|
} // 基础生命周期
|
|||
|
;
|
|||
|
|
|||
|
_proto._init = function _init() {};
|
|||
|
|
|||
|
_proto.clear = function clear() {};
|
|||
|
|
|||
|
_proto.destroy = function destroy() {
|
|||
|
// 之前未指定销毁
|
|||
|
_Base.prototype.destroy.call(this);
|
|||
|
} // 绘图
|
|||
|
;
|
|||
|
|
|||
|
_proto.beforeRender = function beforeRender() {};
|
|||
|
|
|||
|
_proto.render = function render() {} // 初始化、绑事件和绘图
|
|||
|
;
|
|||
|
|
|||
|
_proto.afterRender = function afterRender() {};
|
|||
|
|
|||
|
_proto.beforeDraw = function beforeDraw() {};
|
|||
|
|
|||
|
_proto.draw = function draw() {} // 单纯更新视图
|
|||
|
;
|
|||
|
|
|||
|
_proto.afterDraw = function afterDraw() {} // visibility
|
|||
|
;
|
|||
|
|
|||
|
_proto.show = function show() {};
|
|||
|
|
|||
|
_proto.hide = function hide() {} // props operating syntactic sugar
|
|||
|
;
|
|||
|
|
|||
|
_proto.setOffset = function setOffset() {};
|
|||
|
|
|||
|
_proto.setPosition = function setPosition() {};
|
|||
|
|
|||
|
_proto.setVisible = function setVisible() {};
|
|||
|
|
|||
|
_proto.setZIndex = function setZIndex() {};
|
|||
|
|
|||
|
return Component;
|
|||
|
}(Base);
|
|||
|
|
|||
|
module.exports = Component;
|