sketch-json-parse
Version:
sketch-json解析
27 lines (26 loc) • 897 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
*获取各边宽度
*
* @param {*} layer
* @returns
* {
layerBorderTopWidth,
layerBorderBottomWidth,
layerBorderLeftWidth,
layerBorderRightWidth
}
*/
const getBorderWidth = (layer) => {
var _a, _b, _c, _d, _e;
//父元素边框宽度
const border = ((_a = layer.structure) === null || _a === void 0 ? void 0 : _a.border) || {};
return {
borderTopWidth: ((_b = border.top) === null || _b === void 0 ? void 0 : _b.width) || 0,
borderBottomWidth: ((_c = border.bottom) === null || _c === void 0 ? void 0 : _c.width) || 0,
borderLeftWidth: ((_d = border.left) === null || _d === void 0 ? void 0 : _d.width) || 0,
borderRightWidth: ((_e = border.right) === null || _e === void 0 ? void 0 : _e.width) || 0
};
};
exports.default = getBorderWidth;