UNPKG

@antv/g2plot

Version:

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

39 lines 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var coord_1 = require("@antv/coord"); var variable_node_1 = tslib_1.__importDefault(require("../../../util/responsive/node/variable-node")); var responsive_1 = tslib_1.__importDefault(require("../../../util/responsive/responsive")); function responsiveRing(layer) { var props = layer.options; var responsiveTheme = layer.getResponsiveTheme(); var padding = props.padding; var radius = props.radius ? props.radius : 1; var width = layer.width, height = layer.height; /** 创建坐标系 */ var polar = coord_1.getCoordinate('polar'); var coord = new polar({ radius: radius, start: { x: padding[3], y: padding[0] }, end: { x: width - padding[1], y: height - padding[2] }, }); var region = { radius: radius, coord: coord, }; var nodes = new variable_node_1.default({ nodes: [{ name: 'innerRadius', value: 0 }], }); var constraints = responsiveTheme.ring.constraints; new responsive_1.default({ nodes: nodes, constraints: constraints, region: region, plot: layer, onEnd: function () { props.innerRadius = nodes.nodes[0].value; }, }); } exports.default = responsiveRing; //# sourceMappingURL=geometry.js.map