Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
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
viitto
pptist
Commits
56abfecf
Commit
56abfecf
authored
Dec 19, 2023
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增文字描边特效
parent
a9eebe3d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
slides.ts
src/types/slides.ts
+2
-1
text.ts
src/utils/psdParser/text.ts
+29
-1
index.vue
src/views/components/element/TextElement/index.vue
+1
-0
No files found.
src/types/slides.ts
View file @
56abfecf
...
...
@@ -179,7 +179,8 @@ export interface PPTTextElement extends PPTBaseElement {
contentStr
?:
string
,
TemplateList
?:
unknown
,
TemplateDataSource
?:
DataSourceType
clip
?:
boolean
clip
?:
boolean
,
stroke
?:
string
}
...
...
src/utils/psdParser/text.ts
View file @
56abfecf
...
...
@@ -8,6 +8,7 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
let
domheight
=
item
.
layer
.
height
let
transformRotate
=
0
let
clip
=
false
let
stroke
=
''
const
opacity
=
(
parseFloat
(
item
.
layer
.
opacity
)
/
255.0
)
let
f
=
item
.
layer
.
typeTool
().
export
()
...
...
@@ -64,6 +65,9 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
clip
=
true
style
+=
`background:
${
background
}
!important;-webkit-background-clip: text !important;`
}
if
(
objectEFFFects
&&
objectEFFFects
.
data
?.
FrFX
?.
enab
){
stroke
=
getStrokeHandler
(
objectEFFFects
)
}
let
content
=
`<p><span style="
${
style
}
">
${
value
}
</span></p>`
const
isVertical
=
item
.
layer
.
adjustments
.
typeTool
.
obj
.
textData
.
Ornt
.
value
!=
'Hrzn'
...
...
@@ -104,7 +108,8 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
contentStr
:
value
,
layerName
:
item
.
layer
.
name
,
groupId
:
groupId
,
clip
clip
,
stroke
}
if
(
textShadow
)
element
.
shadow
=
textShadow
...
...
@@ -145,6 +150,29 @@ const getGradient = (obj: any) => {
return
linear
;
}
const
getStrokeHandler
=
(
obj
:
any
)
=>
{
const
{
FrFX
}
=
obj
.
data
const
clrStr
=
JSON
.
stringify
(
FrFX
[
'Clr '
]).
split
(
','
)
let
r
:
string
=
'0'
let
g
:
string
=
'0'
let
b
:
string
=
'0'
clrStr
.
forEach
(
item
=>
{
if
(
item
.
indexOf
(
'Rd'
)
!==
-
1
)
{
r
=
item
.
replace
(
'"Rd ":'
,
''
)
}
else
if
(
item
.
indexOf
(
'Bl'
)
!==
-
1
)
{
b
=
item
.
replace
(
'"Bl ":'
,
''
).
replace
(
'}'
,
''
)
}
else
if
(
item
.
indexOf
(
'Grn'
)
!==
-
1
)
{
g
=
item
.
replace
(
'"Grn ":'
,
''
)
}
})
// let temp = JSON.stringify(FrFX)
// var regex = /(?<="Sc ":).*?(?=})/g
// console.log(FrFX,temp)
const
color
=
`rgba(
${
parseInt
(
r
)}
,
${
parseInt
(
g
)}
,
${
parseInt
(
b
)}
,
${
FrFX
.
Opct
.
value
/
100
}
)`
const
size
=
FrFX
[
'Sz '
].
value
+
"px"
return
`
${
size
}
${
color
}
`
}
const
getShadows
=
(
drsh
:
any
)
=>
{
const
{
DrSh
}
=
drsh
.
data
...
...
src/views/components/element/TextElement/index.vue
View file @
56abfecf
...
...
@@ -27,6 +27,7 @@
color: elementInfo.defaultColor,
fontFamily: elementInfo.defaultFontName,
writingMode: elementInfo.vertical ? 'vertical-rl' : 'horizontal-tb',
WebkitTextStroke: elementInfo.stroke ? elementInfo.stroke:''
}"
:class="{'clip-box':elementInfo.clip}"
...
...
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