Browse Source

fix(avatar): use text instead of foreign object.

Reason: On Safari the foreign object is not scaled correctly.
master
Hristo Terezov 5 years ago
parent
commit
9bdaea4069
2 changed files with 10 additions and 21 deletions
  1. 1
    13
      css/_avatar.scss
  2. 9
    8
      react/features/base/avatar/components/web/StatelessAvatar.js

+ 1
- 13
css/_avatar.scss View File

20
     }
20
     }
21
 }
21
 }
22
 
22
 
23
-.avatar-foreign {
24
-    align-items: center;
25
-    bottom: 0;
26
-    display: flex;
27
-    font-size: 40pt;
28
-    justify-content: center;
29
-    left: 0;
30
-    position: absolute;
31
-    right: 0;
32
-    top: 0;
33
-}
34
-
35
 .avatar-svg {
23
 .avatar-svg {
36
     height: 100%;
24
     height: 100%;
37
     width: 100%;
25
     width: 100%;
63
         @include avatarBadge;
51
         @include avatarBadge;
64
         background-color: $presence-idle;
52
         background-color: $presence-idle;
65
     }
53
     }
66
-}
54
+}

+ 9
- 8
react/features/base/avatar/components/web/StatelessAvatar.js View File

79
                         viewBox = '0 0 100 100'
79
                         viewBox = '0 0 100 100'
80
                         xmlns = 'http://www.w3.org/2000/svg'
80
                         xmlns = 'http://www.w3.org/2000/svg'
81
                         xmlnsXlink = 'http://www.w3.org/1999/xlink'>
81
                         xmlnsXlink = 'http://www.w3.org/1999/xlink'>
82
-                        <foreignObject
83
-                            height = '100%'
84
-                            width = '100%'>
85
-                            <span
86
-                                className = 'avatar-foreign'>
87
-                                { initials }
88
-                            </span>
89
-                        </foreignObject>
82
+                        <text
83
+                            dominantBaseline = 'central'
84
+                            fill = 'rgba(255,255,255,.6)'
85
+                            fontSize = '40pt'
86
+                            textAnchor = 'middle'
87
+                            x = '50'
88
+                            y = '50'>
89
+                            { initials }
90
+                        </text>
90
                     </svg>
91
                     </svg>
91
                 </div>
92
                 </div>
92
             );
93
             );

Loading…
Cancel
Save