@antv/g2plot
Version:
G2 Plot, a market of plots built with the Grammar of Graphics'
36 lines • 1.34 kB
JavaScript
import { __extends } from "tslib";
import ShapeNodes from '../node/shape-nodes';
import Responsive from '../responsive';
import ApplyResponsive from './base';
var ApplyResponsiveLabel = /** @class */ (function (_super) {
__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 ShapeNodes({
shapes: labelShapes,
});
var _a = this.responsiveTheme.label[this.type], constraints = _a.constraints, rules = _a.rules;
new Responsive({
nodes: nodes,
constraints: constraints,
rules: rules,
plot: this.plot,
region: this.plot.view.get('viewRange'),
});
};
ApplyResponsiveLabel.prototype.getType = function () {
return null;
};
return ApplyResponsiveLabel;
}(ApplyResponsive));
export default ApplyResponsiveLabel;
//# sourceMappingURL=label.js.map