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
358bd784
Commit
358bd784
authored
Jun 05, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复
parent
53d8e362
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
91 additions
and
31 deletions
+91
-31
index.es.js
dist/index.es.js
+22
-7
index.es.js.map
dist/index.es.js.map
+1
-1
index.js
dist/index.js
+22
-7
index.js.map
dist/index.js.map
+1
-1
index.umd.js
dist/index.umd.js
+22
-7
index.umd.js.map
dist/index.umd.js.map
+1
-1
zeroing.js
src/zeroing.js
+22
-7
No files found.
dist/index.es.js
View file @
358bd784
...
@@ -80,9 +80,24 @@ const relativePosPrefixMap = {
...
@@ -80,9 +80,24 @@ const relativePosPrefixMap = {
bp
:
{
field
:
'bottom'
,
},
bp
:
{
field
:
'bottom'
,
},
};
};
const
offsetAll
=
176
;
async
function
execute
(
psdFile
,
options
)
{
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
const
{
mode
=
'none'
}
=
options
;
let
offset
=
{
x
:
0
,
y
:
0
};
let
cutSize
=
{
x
:
0
,
y
:
0
};
if
(
mode
!==
'none'
){
cutSize
.
y
=
offsetAll
;
}
switch
(
mode
){
case
'top'
:
offset
.
y
=
offsetAll
;
break
;
case
'center'
:
offset
.
y
=
offsetAll
/
2
;
break
;
}
let
viewRoot
=
{
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
@@ -94,8 +109,8 @@ async function execute(psdFile, options) {
...
@@ -94,8 +109,8 @@ async function execute(psdFile, options) {
const
imageHashMap
=
{};
const
imageHashMap
=
{};
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageWidth
-=
0
;
stageHeight
-=
offset
.
y
||
0
;
stageHeight
-=
cutSize
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
let
{
name
}
=
node
;
...
@@ -136,10 +151,10 @@ async function execute(psdFile, options) {
...
@@ -136,10 +151,10 @@ async function execute(psdFile, options) {
value
=
y
-
offset
.
y
;
value
=
y
-
offset
.
y
;
break
;
break
;
case
'r'
:
case
'r'
:
value
=
stageWidth
-
width
;
value
=
stageWidth
-
(
x
-
offset
.
x
)
-
width
;
break
;
break
;
case
'b'
:
case
'b'
:
value
=
stageHeight
-
height
;
value
=
stageHeight
-
(
y
-
offset
.
y
)
-
height
;
break
;
break
;
case
'h'
:
case
'h'
:
value
=
x
+
width
/
2
-
stageWidth
/
2
;
value
=
x
+
width
/
2
-
stageWidth
/
2
;
...
@@ -187,10 +202,10 @@ async function execute(psdFile, options) {
...
@@ -187,10 +202,10 @@ async function execute(psdFile, options) {
};
};
let
dealLater
=
true
;
let
dealLater
=
true
;
if
(
x
!==
0
)
{
if
(
x
!==
0
)
{
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
);
properties
.
x
=
x
;
//
- (isSecondLayer ? offset.x : 0);
}
}
if
(
y
!==
0
)
{
if
(
y
!==
0
)
{
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
);
properties
.
y
=
y
;
//
- (isSecondLayer ? offset.y : 0);
}
}
if
(
typeTool
)
{
if
(
typeTool
)
{
...
...
dist/index.es.js.map
View file @
358bd784
This diff is collapsed.
Click to expand it.
dist/index.js
View file @
358bd784
...
@@ -86,9 +86,24 @@ const relativePosPrefixMap = {
...
@@ -86,9 +86,24 @@ const relativePosPrefixMap = {
bp
:
{
field
:
'bottom'
,
},
bp
:
{
field
:
'bottom'
,
},
};
};
const
offsetAll
=
176
;
async
function
execute
(
psdFile
,
options
)
{
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
const
{
mode
=
'none'
}
=
options
;
let
offset
=
{
x
:
0
,
y
:
0
};
let
cutSize
=
{
x
:
0
,
y
:
0
};
if
(
mode
!==
'none'
){
cutSize
.
y
=
offsetAll
;
}
switch
(
mode
){
case
'top'
:
offset
.
y
=
offsetAll
;
break
;
case
'center'
:
offset
.
y
=
offsetAll
/
2
;
break
;
}
let
viewRoot
=
{
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
@@ -100,8 +115,8 @@ async function execute(psdFile, options) {
...
@@ -100,8 +115,8 @@ async function execute(psdFile, options) {
const
imageHashMap
=
{};
const
imageHashMap
=
{};
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageWidth
-=
0
;
stageHeight
-=
offset
.
y
||
0
;
stageHeight
-=
cutSize
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
let
{
name
}
=
node
;
...
@@ -142,10 +157,10 @@ async function execute(psdFile, options) {
...
@@ -142,10 +157,10 @@ async function execute(psdFile, options) {
value
=
y
-
offset
.
y
;
value
=
y
-
offset
.
y
;
break
;
break
;
case
'r'
:
case
'r'
:
value
=
stageWidth
-
width
;
value
=
stageWidth
-
(
x
-
offset
.
x
)
-
width
;
break
;
break
;
case
'b'
:
case
'b'
:
value
=
stageHeight
-
height
;
value
=
stageHeight
-
(
y
-
offset
.
y
)
-
height
;
break
;
break
;
case
'h'
:
case
'h'
:
value
=
x
+
width
/
2
-
stageWidth
/
2
;
value
=
x
+
width
/
2
-
stageWidth
/
2
;
...
@@ -193,10 +208,10 @@ async function execute(psdFile, options) {
...
@@ -193,10 +208,10 @@ async function execute(psdFile, options) {
};
};
let
dealLater
=
true
;
let
dealLater
=
true
;
if
(
x
!==
0
)
{
if
(
x
!==
0
)
{
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
);
properties
.
x
=
x
;
//
- (isSecondLayer ? offset.x : 0);
}
}
if
(
y
!==
0
)
{
if
(
y
!==
0
)
{
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
);
properties
.
y
=
y
;
//
- (isSecondLayer ? offset.y : 0);
}
}
if
(
typeTool
)
{
if
(
typeTool
)
{
...
...
dist/index.js.map
View file @
358bd784
This diff is collapsed.
Click to expand it.
dist/index.umd.js
View file @
358bd784
...
@@ -86,9 +86,24 @@
...
@@ -86,9 +86,24 @@
bp
:
{
field
:
'bottom'
,
},
bp
:
{
field
:
'bottom'
,
},
};
};
const
offsetAll
=
176
;
async
function
execute
(
psdFile
,
options
)
{
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
const
{
mode
=
'none'
}
=
options
;
let
offset
=
{
x
:
0
,
y
:
0
};
let
cutSize
=
{
x
:
0
,
y
:
0
};
if
(
mode
!==
'none'
){
cutSize
.
y
=
offsetAll
;
}
switch
(
mode
){
case
'top'
:
offset
.
y
=
offsetAll
;
break
;
case
'center'
:
offset
.
y
=
offsetAll
/
2
;
break
;
}
let
viewRoot
=
{
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
@@ -100,8 +115,8 @@
...
@@ -100,8 +115,8 @@
const
imageHashMap
=
{};
const
imageHashMap
=
{};
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageWidth
-=
0
;
stageHeight
-=
offset
.
y
||
0
;
stageHeight
-=
cutSize
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
let
{
name
}
=
node
;
...
@@ -142,10 +157,10 @@
...
@@ -142,10 +157,10 @@
value
=
y
-
offset
.
y
;
value
=
y
-
offset
.
y
;
break
;
break
;
case
'r'
:
case
'r'
:
value
=
stageWidth
-
width
;
value
=
stageWidth
-
(
x
-
offset
.
x
)
-
width
;
break
;
break
;
case
'b'
:
case
'b'
:
value
=
stageHeight
-
height
;
value
=
stageHeight
-
(
y
-
offset
.
y
)
-
height
;
break
;
break
;
case
'h'
:
case
'h'
:
value
=
x
+
width
/
2
-
stageWidth
/
2
;
value
=
x
+
width
/
2
-
stageWidth
/
2
;
...
@@ -193,10 +208,10 @@
...
@@ -193,10 +208,10 @@
};
};
let
dealLater
=
true
;
let
dealLater
=
true
;
if
(
x
!==
0
)
{
if
(
x
!==
0
)
{
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
);
properties
.
x
=
x
;
//
- (isSecondLayer ? offset.x : 0);
}
}
if
(
y
!==
0
)
{
if
(
y
!==
0
)
{
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
);
properties
.
y
=
y
;
//
- (isSecondLayer ? offset.y : 0);
}
}
if
(
typeTool
)
{
if
(
typeTool
)
{
...
...
dist/index.umd.js.map
View file @
358bd784
This diff is collapsed.
Click to expand it.
src/zeroing.js
View file @
358bd784
...
@@ -27,9 +27,24 @@ const relativePosPrefixMap = {
...
@@ -27,9 +27,24 @@ const relativePosPrefixMap = {
bp
:
{
field
:
'bottom'
,
},
bp
:
{
field
:
'bottom'
,
},
};
};
const
offsetAll
=
176
;
export
async
function
execute
(
psdFile
,
options
)
{
export
async
function
execute
(
psdFile
,
options
)
{
const
tree
=
await
getTree
(
psdFile
);
const
tree
=
await
getTree
(
psdFile
);
const
offset
=
options
?
options
.
offset
:
{
x
:
0
,
y
:
0
};
const
{
mode
=
'none'
}
=
options
;
let
offset
=
{
x
:
0
,
y
:
0
};
let
cutSize
=
{
x
:
0
,
y
:
0
};
if
(
mode
!==
'none'
){
cutSize
.
y
=
offsetAll
;
}
switch
(
mode
){
case
'top'
:
offset
.
y
=
offsetAll
;
break
;
case
'center'
:
offset
.
y
=
offsetAll
/
2
;
break
;
}
let
viewRoot
=
{
let
viewRoot
=
{
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
name
:
path
.
basename
(
psdFile
.
name
,
'.psd'
),
...
@@ -41,8 +56,8 @@ export async function execute(psdFile, options) {
...
@@ -41,8 +56,8 @@ export async function execute(psdFile, options) {
const
imageHashMap
=
{};
const
imageHashMap
=
{};
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
let
{
width
:
stageWidth
,
height
:
stageHeight
}
=
tree
;
stageWidth
-=
offset
.
x
||
0
;
stageWidth
-=
cutSize
.
x
||
0
;
stageHeight
-=
offset
.
y
||
0
;
stageHeight
-=
cutSize
.
y
||
0
;
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
await
walkNode
(
tree
,
async
function
(
node
,
parent
)
{
let
{
name
}
=
node
;
let
{
name
}
=
node
;
...
@@ -85,10 +100,10 @@ export async function execute(psdFile, options) {
...
@@ -85,10 +100,10 @@ export async function execute(psdFile, options) {
value
=
y
-
offset
.
y
;
value
=
y
-
offset
.
y
;
break
;
break
;
case
'r'
:
case
'r'
:
value
=
stageWidth
-
width
;
value
=
stageWidth
-
(
x
-
offset
.
x
)
-
width
;
break
;
break
;
case
'b'
:
case
'b'
:
value
=
stageHeight
-
height
;
value
=
stageHeight
-
(
y
-
offset
.
y
)
-
height
;
break
;
break
;
case
'h'
:
case
'h'
:
value
=
x
+
width
/
2
-
stageWidth
/
2
;
value
=
x
+
width
/
2
-
stageWidth
/
2
;
...
@@ -136,10 +151,10 @@ export async function execute(psdFile, options) {
...
@@ -136,10 +151,10 @@ export async function execute(psdFile, options) {
};
};
let
dealLater
=
true
;
let
dealLater
=
true
;
if
(
x
!==
0
)
{
if
(
x
!==
0
)
{
properties
.
x
=
x
-
(
isSecondLayer
?
offset
.
x
:
0
);
properties
.
x
=
x
;
//
- (isSecondLayer ? offset.x : 0);
}
}
if
(
y
!==
0
)
{
if
(
y
!==
0
)
{
properties
.
y
=
y
-
(
isSecondLayer
?
offset
.
y
:
0
);
properties
.
y
=
y
;
//
- (isSecondLayer ? offset.y : 0);
}
}
if
(
typeTool
)
{
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