Commit 56abfecf authored by 罗超's avatar 罗超

新增文字描边特效

parent a9eebe3d
......@@ -179,7 +179,8 @@ export interface PPTTextElement extends PPTBaseElement {
contentStr?: string,
TemplateList?: unknown,
TemplateDataSource?: DataSourceType
clip?:boolean
clip?:boolean,
stroke?:string
}
......
......@@ -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
......
......@@ -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}"
......
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