UNPKG

sketch-json-parse

Version:

sketch-json解析

22 lines (21 loc) 874 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const parseBorder_1 = require("./parseBorder"); const utils_1 = require("../../common/utils"); const parseStructure = (layer) => { var _a, _b; const { x, y, height, width } = layer.frame; const border = (0, parseBorder_1.default)(layer); // shapePath等类型图片,记录border信息 if (layer._class === 'image' && ((_b = (_a = layer.panel.fills) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.type) === 0) { layer.panel.styleBorder = border; } return { x: (0, utils_1.precisionControl)(x), y: (0, utils_1.precisionControl)(y), width: (0, utils_1.precisionControl)(width), height: (0, utils_1.precisionControl)(height), border: border, }; }; exports.default = parseStructure;