UNPKG

@antv/g2plot

Version:

G2 Plot, a market of plots built with the Grammar of Graphics'

53 lines 2.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var g2_1 = require("@antv/g2"); var BaseInteraction = /** @class */ (function (_super) { tslib_1.__extends(BaseInteraction, _super); function BaseInteraction(cfg, viewLayer, interactionRange, interaction) { var _this = _super.call(this, cfg) || this; _this.viewLayer = viewLayer; _this.interactionRange = interactionRange; _this.interactionConfig = interaction; _this.render(); return _this; } BaseInteraction.registerInteraction = function (type, ctor) { BaseInteraction.GLOBAL_INTERACTION_MAP[type] = ctor; }; BaseInteraction.registerPlotInteraction = function (plotType, type, ctor) { if (!BaseInteraction.PLOT_INTERACTION_MAP[plotType]) { BaseInteraction.PLOT_INTERACTION_MAP[plotType] = {}; } BaseInteraction.PLOT_INTERACTION_MAP[plotType][type] = ctor; }; BaseInteraction.getInteraction = function (type, plotType) { if (plotType && BaseInteraction.PLOT_INTERACTION_MAP[plotType] && BaseInteraction[plotType][type]) { return BaseInteraction.PLOT_INTERACTION_MAP[plotType][type]; } return BaseInteraction.GLOBAL_INTERACTION_MAP[type]; }; BaseInteraction.getInteractionRange = function (layerRange, interaction) { return undefined; }; BaseInteraction.prototype.destroy = function () { this.clear(); _super.prototype.destroy.call(this); }; BaseInteraction.prototype.getViewLayer = function () { return this.viewLayer; }; BaseInteraction.prototype.getRange = function () { return this.interactionRange; }; BaseInteraction.prototype.getInteractionConfig = function () { return this.interactionConfig; }; BaseInteraction.prototype.render = function () { }; BaseInteraction.prototype.clear = function () { }; BaseInteraction.GLOBAL_INTERACTION_MAP = {}; BaseInteraction.PLOT_INTERACTION_MAP = {}; return BaseInteraction; }(g2_1.Interaction)); exports.default = BaseInteraction; //# sourceMappingURL=base.js.map