Browse Source

fix: 分享图上移56

王晓东 2 weeks ago
parent
commit
0fb26e5032
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/components/custom-share/index.tsx

+ 5 - 1
src/components/custom-share/index.tsx

@@ -70,7 +70,7 @@ export default (props: Props) => {
 
     let avatarImg = agent.avatarLogo ?? DEFAULT_AVATAR_SHARE_BG
     
-    stage.backgroundColor = 'red'
+    stage.backgroundColor = 'white'
 
     // 如果有头像,加载头像图片先
     const imgArr = [
@@ -95,6 +95,10 @@ export default (props: Props) => {
       dWidth: canvasWidth,
       dHeight: (canvasWidth / avatarTexture.width) * avatarTexture.height,
     });
+    // 如果有头像,则需要上提,以显示出头像,如果是默认图则无需上提
+    if(agent.avatarLogo){
+      avatar.y = -56 * ratio;
+    }
     const avatarWrapper = new Container()
     avatarWrapper.width = canvasWidth
     avatarWrapper.height = 100