From 9b02749ee51f5d8373693fe2b5ea8f43e9d8f22e Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 28 Oct 2023 01:00:09 +0800 Subject: [PATCH] [Bugfix] Update label width calculation logic (#198) 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));