UNPKG

@antv/g6

Version:

A Graph Visualization Framework in JavaScript

22 lines 910 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.inferIconStyle = inferIconStyle; const size_1 = require("./size"); /** * <zh/> 如果没有手动指定图标大小,则根据主图形尺寸自动推断 * * <en/> Infer the icon size according to key size if icon size is not manually specified * @param size - <zh/> 主图形尺寸 | <en/> Key size * @param iconStyle - <zh/> 图标样式 | <en/> Icon style * @returns <zh/> 图标样式 | <en/> Icon style */ function inferIconStyle(size, iconStyle) { const stdSize = (0, size_1.parseSize)(size); let style = {}; if (iconStyle.text && !iconStyle.fontSize) style = { fontSize: Math.min(...stdSize) * 0.5 }; if (iconStyle.src && (!iconStyle.width || !iconStyle.height)) style = { width: stdSize[0] * 0.5, height: stdSize[1] * 0.5 }; return style; } //# sourceMappingURL=node.js.map