UNPKG

@antv/g2plot

Version:

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

38 lines 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var shape_nodes_1 = tslib_1.__importDefault(require("../node/shape-nodes")); var responsive_1 = tslib_1.__importDefault(require("../responsive")); var base_1 = tslib_1.__importDefault(require("./base")); var ApplyResponsiveLabel = /** @class */ (function (_super) { tslib_1.__extends(ApplyResponsiveLabel, _super); function ApplyResponsiveLabel() { return _super !== null && _super.apply(this, arguments) || this; } ApplyResponsiveLabel.prototype.shouldApply = function () { if (!this.responsiveTheme.label || !this.responsiveTheme.label[this.type]) { return false; } return true; }; ApplyResponsiveLabel.prototype.apply = function () { var labelShapes = this.plot.view.get('elements')[0].get('labels'); var nodes = new shape_nodes_1.default({ shapes: labelShapes, }); var _a = this.responsiveTheme.label[this.type], constraints = _a.constraints, rules = _a.rules; new responsive_1.default({ nodes: nodes, constraints: constraints, rules: rules, plot: this.plot, region: this.plot.view.get('viewRange'), }); }; ApplyResponsiveLabel.prototype.getType = function () { return null; }; return ApplyResponsiveLabel; }(base_1.default)); exports.default = ApplyResponsiveLabel; //# sourceMappingURL=label.js.map