Skip to content

Commit

Permalink
fix: 超出文本
Browse files Browse the repository at this point in the history
  • Loading branch information
XasYer committed Jan 11, 2025
1 parent c2a41c2 commit b914e02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion models/canvas/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function toImage (canvas) {
*/
export function shortenText (ctx, text, maxWidth, replace = '...') {
if (!text) return ''
maxWidth += ctx.measureText(replace).width
maxWidth -= ctx.measureText(replace).width
if (ctx.measureText(text).width < maxWidth) return text
while (ctx.measureText(text).width > maxWidth) {
text = text.slice(0, -1)
Expand Down
2 changes: 1 addition & 1 deletion models/utils/steam.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export function getStateColor (state) {
* @returns {Promise<{[appid: string]: import('models/db/game').GameColumns}>}
*/
export async function getGameName (appids) {
appids = appids.filter(Boolean).map(String)
appids = _.uniq(appids.filter(Boolean).map(String))
if (!appids.length) {
return {}
}
Expand Down

0 comments on commit b914e02

Please sign in to comment.