|
35 | 35 | sub currentUserChanged() |
36 | 36 | m.user.text = m.top.currentUser |
37 | 37 |
|
38 | | - if not isValid(m.userImagePoster) |
39 | | - m.userImagePoster = createUserImage() |
40 | | - end if |
41 | | - |
42 | 38 | if m.top.currentUser = "" |
| 39 | + ' remove the user image node if it exists |
43 | 40 | userImage = m.userGroup.findNode("userImage") |
44 | 41 | if isValid(userImage) |
45 | 42 | m.userGroup.removeChild(userImage) |
46 | 43 | end if |
| 44 | + ' remove cached user image if it exists |
| 45 | + m.userImage = invalid |
47 | 46 | else |
48 | | - m.userGroup.insertChild(m.userImagePoster, 0) |
| 47 | + ' cache the user image node if needed |
| 48 | + if not isValid(m.userImage) |
| 49 | + m.userImage = createUserImage() |
| 50 | + end if |
| 51 | + ' add the user image node to the overhang |
| 52 | + m.userGroup.insertChild(m.userImage, 0) |
49 | 53 | end if |
50 | 54 | end sub |
51 | 55 |
|
|
62 | 66 |
|
63 | 67 | userImage = createObject("roSGNode", "Poster") |
64 | 68 | userImage.id = "userImage" |
65 | | - userImage.uri = buildURL(Substitute("/Users/{0}/Images/Primary", m.global.session.user.id), imgParams) |
66 | 69 | userImage.width = "36" |
67 | 70 | userImage.height = "36" |
68 | | - userImage.translation = "[0, -2]" |
| 71 | + |
| 72 | + if isValid(imgTag) and imgTag <> "" |
| 73 | + ' reset defaults |
| 74 | + m.userGroup.itemSpacings = 15 |
| 75 | + userImage.blendColor = "0xFFFFFFFF" |
| 76 | + |
| 77 | + if m.global.session.server.url <> "" |
| 78 | + userImage.uri = buildURL(Substitute("/Users/{0}/Images/Primary", m.global.session.user.id), imgParams) |
| 79 | + else |
| 80 | + print "ERROR: No server URL set, cannot load user image" |
| 81 | + end if |
| 82 | + |
| 83 | + else |
| 84 | + m.userGroup.itemSpacings = 9 ' account for default image padding |
| 85 | + userImage.blendColor = m.global.constants.colors.text_secondary |
| 86 | + |
| 87 | + userImage.uri = "pkg:/images/icons/person_36px.png" |
| 88 | + end if |
69 | 89 |
|
70 | 90 | return userImage |
71 | 91 | end function |
|
0 commit comments