From 26da5f08d4664c3011ab15aefd712671f0aca1de Mon Sep 17 00:00:00 2001 From: XPA Date: Mon, 20 Nov 2023 02:57:22 +0900 Subject: [PATCH] refactor: flash comment --- src/comments/FlashComment.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/comments/FlashComment.ts b/src/comments/FlashComment.ts index 9e75d785..a302d560 100755 --- a/src/comments/FlashComment.ts +++ b/src/comments/FlashComment.ts @@ -368,12 +368,16 @@ class FlashComment extends BaseComment { const atButtonRadius = getConfig(config.atButtonRadius, true); const isHover = this.isHovered(cursor, posX, posY); context.save(); - context.strokeStyle = - this.comment.button.limit < 1 - ? "#777777" - : isHover - ? this.comment.color - : "white"; + const getStrokeStyle = () => { + if (isHover) { + return this.comment.color; + } + if (this.comment.button && this.comment.button.limit < 1) { + return "#777777"; + } + return "white"; + }; + context.strokeStyle = getStrokeStyle(); drawLeftBorder( context, parts.left.left,