Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psd-parse-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
psd-parse-web
Commits
d88e43ad
Commit
d88e43ad
authored
Jul 22, 2021
by
张九刚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增透明度属性解析
parent
44d8e594
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
package.json
package.json
+1
-1
compilelocal.js
src/compilelocal.js
+13
-4
No files found.
package.json
View file @
d88e43ad
{
{
"name"
:
"psd-parse-web"
,
"name"
:
"psd-parse-web"
,
"version"
:
"2.1.
4
"
,
"version"
:
"2.1.
5
"
,
"main"
:
"src/index.js"
,
"main"
:
"src/index.js"
,
"module"
:
"dist/index.es.js"
,
"module"
:
"dist/index.es.js"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/compilelocal.js
View file @
d88e43ad
...
@@ -59,13 +59,17 @@
...
@@ -59,13 +59,17 @@
if
(
!
page
.
children
)
{
if
(
!
page
.
children
)
{
console
.
warn
(
`
${
page
.
name
}
不合法,请保持设计稿根目录为全部文件夹形式`
);
console
.
warn
(
`
${
page
.
name
}
不合法,请保持设计稿根目录为全部文件夹形式`
);
}
else
{
}
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
=
{
const
viewNode
=
{
name
:
folderName
,
name
:
folderName
,
nodeType
:
'Div'
,
nodeType
:
'Div'
,
properties
:
{
properties
:
{
style
:
{
style
:
{
width
,
height
,
left
:
x
,
top
:
y
,
position
:
"absolute"
width
,
height
,
left
:
x
,
top
:
y
,
position
:
"absolute"
,
...
opacityObj
},
},
attrs
:
{
attrs
:
{
...
@@ -80,11 +84,16 @@
...
@@ -80,11 +84,16 @@
}
}
await
walkNode
(
page
,
async
(
node
,
parent
)
=>
{
await
walkNode
(
page
,
async
(
node
,
parent
)
=>
{
let
{
name
}
=
node
;
let
{
name
}
=
node
;
name
=
trimCustom
(
name
);
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
=
{
let
properties
=
{
style
:
{
style
:
{
width
,
height
,
left
:
x
,
top
:
y
,
position
:
"absolute"
width
,
height
,
left
:
x
,
top
:
y
,
position
:
"absolute"
,
...
opacityObj
},
},
attrs
:
{
attrs
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment