From 8c873c7d0265a3f7903568ed6933b248f35f6ba3 Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 27 Oct 2023 23:28:48 +0800 Subject: [PATCH] [Bugfix] Update label width calculation logic When scrollbar is enabled, there is an extra 11 width. --- .../ViewController/View/WordResultView/EZWordResultView.m | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Easydict/Feature/ViewController/View/WordResultView/EZWordResultView.m b/Easydict/Feature/ViewController/View/WordResultView/EZWordResultView.m index 3b9b1ab94..42587aee4 100644 --- a/Easydict/Feature/ViewController/View/WordResultView/EZWordResultView.m +++ b/Easydict/Feature/ViewController/View/WordResultView/EZWordResultView.m @@ -910,10 +910,7 @@ - (void)updateTagButton:(NSButton *)tagButton tagColor:(NSColor *)tagColor { - (CGSize)labelSize:(EZLabel *)label exceptedWidth:(CGFloat)exceptedWidth { // ???: 很奇怪,比如实际计算结果为 364,但界面渲染却是 364.5 😑 - - NSWindow *window = [self windowOfType:self.result.service.windowType]; - CGFloat selfWidth = window ? window.width - EZHorizontalCellSpacing_10 * 2 : self.width; - CGFloat width = selfWidth - exceptedWidth; + CGFloat width = self.width - exceptedWidth; // NSLog(@"text: %@, width: %@", label.text, @(width)); // NSLog(@"self.width: %@, selfWidth: %@", @(self.width), @(selfWidth));