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
53d8e362
Commit
53d8e362
authored
May 26, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加偏移量参数设置
parent
ce8ed08c
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
23 deletions
+39
-23
index.es.js
dist/index.es.js
+9
-5
index.es.js.map
dist/index.es.js.map
+1
-1
index.js
dist/index.js
+9
-5
index.js.map
dist/index.js.map
+1
-1
index.umd.js
dist/index.umd.js
+9
-5
index.umd.js.map
dist/index.umd.js.map
+1
-1
zeroing.js
src/zeroing.js
+9
-5
No files found.
dist/index.es.js
View file @
53d8e362
...
...
@@ -82,6 +82,7 @@ const relativePosPrefixMap = {
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
...
@@ -92,7 +93,9 @@ async function execute(psdFile, options) {
const
assets
=
[];
const
imageHashMap
=
{};
const
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageHeight
-=
offset
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
...
...
@@ -101,6 +104,7 @@ async function execute(psdFile, options) {
let
properties
=
{
width
,
height
,
alpha
,
visible
,
};
const
isSecondLayer
=
!
parent
.
origin
.
parent
;
if
(
name
.
includes
(
'|'
))
{
try
{
...
...
@@ -126,10 +130,10 @@ async function execute(psdFile, options) {
if
(
!
hasValue
){
switch
(
fieldChar
){
case
'l'
:
value
=
x
;
value
=
x
-
offset
.
x
;
break
;
case
't'
:
value
=
y
;
value
=
y
-
offset
.
y
;
break
;
case
'r'
:
value
=
stageWidth
-
width
;
...
...
@@ -183,10 +187,10 @@ async function execute(psdFile, options) {
};
let
dealLater
=
true
;
if
(
x
!==
0
)
{
properties
.
x
=
x
;
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
)
;
}
if
(
y
!==
0
)
{
properties
.
y
=
y
;
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
)
;
}
if
(
typeTool
)
{
...
...
dist/index.es.js.map
View file @
53d8e362
This diff is collapsed.
Click to expand it.
dist/index.js
View file @
53d8e362
...
...
@@ -88,6 +88,7 @@ const relativePosPrefixMap = {
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
...
@@ -98,7 +99,9 @@ async function execute(psdFile, options) {
const
assets
=
[];
const
imageHashMap
=
{};
const
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageHeight
-=
offset
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
...
...
@@ -107,6 +110,7 @@ async function execute(psdFile, options) {
let
properties
=
{
width
,
height
,
alpha
,
visible
,
};
const
isSecondLayer
=
!
parent
.
origin
.
parent
;
if
(
name
.
includes
(
'|'
))
{
try
{
...
...
@@ -132,10 +136,10 @@ async function execute(psdFile, options) {
if
(
!
hasValue
){
switch
(
fieldChar
){
case
'l'
:
value
=
x
;
value
=
x
-
offset
.
x
;
break
;
case
't'
:
value
=
y
;
value
=
y
-
offset
.
y
;
break
;
case
'r'
:
value
=
stageWidth
-
width
;
...
...
@@ -189,10 +193,10 @@ async function execute(psdFile, options) {
};
let
dealLater
=
true
;
if
(
x
!==
0
)
{
properties
.
x
=
x
;
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
)
;
}
if
(
y
!==
0
)
{
properties
.
y
=
y
;
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
)
;
}
if
(
typeTool
)
{
...
...
dist/index.js.map
View file @
53d8e362
This diff is collapsed.
Click to expand it.
dist/index.umd.js
View file @
53d8e362
...
...
@@ -88,6 +88,7 @@
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
...
@@ -98,7 +99,9 @@
const
assets
=
[];
const
imageHashMap
=
{};
const
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageHeight
-=
offset
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
...
...
@@ -107,6 +110,7 @@
let
properties
=
{
width
,
height
,
alpha
,
visible
,
};
const
isSecondLayer
=
!
parent
.
origin
.
parent
;
if
(
name
.
includes
(
'|'
))
{
try
{
...
...
@@ -132,10 +136,10 @@
if
(
!
hasValue
){
switch
(
fieldChar
){
case
'l'
:
value
=
x
;
value
=
x
-
offset
.
x
;
break
;
case
't'
:
value
=
y
;
value
=
y
-
offset
.
y
;
break
;
case
'r'
:
value
=
stageWidth
-
width
;
...
...
@@ -189,10 +193,10 @@
};
let
dealLater
=
true
;
if
(
x
!==
0
)
{
properties
.
x
=
x
;
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
)
;
}
if
(
y
!==
0
)
{
properties
.
y
=
y
;
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
)
;
}
if
(
typeTool
)
{
...
...
dist/index.umd.js.map
View file @
53d8e362
This diff is collapsed.
Click to expand it.
src/zeroing.js
View file @
53d8e362
...
...
@@ -29,6 +29,7 @@ const relativePosPrefixMap = {
export
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
...
@@ -39,7 +40,9 @@ export async function execute(psdFile, options) {
const
assets
=
[];
const
imageHashMap
=
{};
const
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageHeight
-=
offset
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
...
...
@@ -48,6 +51,7 @@ export async function execute(psdFile, options) {
let
properties
=
{
width
,
height
,
alpha
,
visible
,
};
const
isSecondLayer
=
!
parent
.
origin
.
parent
;
const
{
width
:
parentWidth
,
height
:
parentHeight
}
=
parent
;
...
...
@@ -75,10 +79,10 @@ export async function execute(psdFile, options) {
if
(
!
hasValue
){
switch
(
fieldChar
){
case
'l'
:
value
=
x
;
value
=
x
-
offset
.
x
;
break
;
case
't'
:
value
=
y
;
value
=
y
-
offset
.
y
;
break
;
case
'r'
:
value
=
stageWidth
-
width
;
...
...
@@ -132,10 +136,10 @@ export async function execute(psdFile, options) {
};
let
dealLater
=
true
;
if
(
x
!==
0
)
{
properties
.
x
=
x
;
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
)
;
}
if
(
y
!==
0
)
{
properties
.
y
=
y
;
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
)
;
}
if
(
typeTool
)
{
...
...
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