Commit d88e43ad authored by 张九刚's avatar 张九刚

新增透明度属性解析

parent 44d8e594
{
"name": "psd-parse-web",
"version": "2.1.4",
"version": "2.1.5",
"main": "src/index.js",
"module": "dist/index.es.js",
"license": "MIT",
......
......@@ -59,13 +59,17 @@
if (!page.children) {
console.warn(`${page.name}不合法,请保持设计稿根目录为全部文件夹形式`);
} else {
const { x, y, width, height } = page;
const { x, y, width, height, alpha } = page;
let opacityObj = {};
if (alpha != 1) {
opacityObj = { opacity: alpha.toFixed(2) };
}
const viewNode = {
name: folderName,
nodeType: 'Div',
properties: {
style: {
width, height, left: x, top: y, position: "absolute"
width, height, left: x, top: y, position: "absolute", ...opacityObj
},
attrs: {
......@@ -80,11 +84,16 @@
}
await walkNode(page, async (node, parent) => {
let { name } = node;
name = trimCustom(name);
const { x, y, width, height, origin: { layer, layer: { typeTool, solidColor } } } = node;
const { x, y, width, height, alpha,origin: { layer, layer: { typeTool, solidColor } } } = node;
let opacityObj = {};
if (alpha != 1) {
opacityObj = { opacity: alpha.toFixed(2) };
}
let properties = {
style: {
width, height, left: x, top: y, position: "absolute"
width, height, left: x, top: y, position: "absolute", ...opacityObj
},
attrs: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment