@visactor/vchart
Version:
charts lib based @visactor/VGrammar
28 lines (22 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.getInnerMostElements = exports.computeRatio = void 0;
const vutils_1 = require("@visactor/vutils"), enum_1 = require("../../../mark/interface/enum"), computeRatio = (angle, range) => {
const ratio = (angle - range[0]) / (range[1] - range[0] || 1);
return Math.max(0, Math.min(1, ratio));
};
exports.computeRatio = computeRatio;
const getInnerMostElements = graphics => {
const updateElements = graphics.filter((g => g.context.diffState === enum_1.DiffState.update)), minDepth = (0,
vutils_1.minInArray)(updateElements.map((g => {
var _a, _b;
return null === (_b = null === (_a = null == g ? void 0 : g.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0].depth;
})));
return updateElements.filter((g => {
var _a, _b;
return (null === (_b = null === (_a = null == g ? void 0 : g.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0].depth) === minDepth;
}));
};
exports.getInnerMostElements = getInnerMostElements;
//# sourceMappingURL=utils.js.map