Skip to content

Commit

Permalink
fix: update queryViewHeight when window configuration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Oct 26, 2024
1 parent 9b32571 commit d893137
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ - (void)viewWillAppear {

- (void)setupData {
self.queryModel = [[EZQueryModel alloc] init];
self.queryModel.queryViewHeight = [self miniQueryViewHeight];

self.detectManager = [EZDetectManager managerWithModel:self.queryModel];

Expand Down Expand Up @@ -224,6 +223,8 @@ - (void)updateWindowConfiguration:(NSNotification *)notification {
return;
}

self.queryModel.queryViewHeight = [self miniQueryViewHeight];

self.isInputFieldCellVisible = [Configuration.shared showInputTextFieldWithKey:WindowConfigurationKeyInputFieldCellVisible
windowType:self.windowType];
self.isSelectLanguageCellVisible = [Configuration.shared showInputTextFieldWithKey:WindowConfigurationKeySelectLanguageCellVisible
Expand All @@ -247,9 +248,7 @@ - (void)updateWindowConfiguration:(NSNotification *)notification {
}
}

[self reloadTableViewData:^{
// [self updateTableViewHeight];
}];
[self reloadTableViewData:nil];
}

- (void)modifyLanduage:(NSNotification *)notification {
Expand Down Expand Up @@ -1589,11 +1588,11 @@ - (void)updateWindowHeightWithLock:(BOOL)lockFlag {

CGFloat scrollViewHeight = height + self.scrollView.contentInsets.top + self.scrollView.contentInsets.bottom;
scrollViewHeight = MIN(scrollViewHeight, maxWindowSize.height - titleBarHeight);
// MMLogInfo(@"scrollViewHeight: %@", @(scrollViewHeight));

// Diable change window height manually.
[self.scrollView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_greaterThanOrEqualTo(scrollViewHeight);
make.height.mas_lessThanOrEqualTo(scrollViewHeight);
make.height.equalTo(@(scrollViewHeight)).priority(MASLayoutPriorityDefaultHigh);
}];

CGFloat showingWindowHeight = scrollViewHeight + titleBarHeight;
Expand Down Expand Up @@ -1621,7 +1620,7 @@ - (void)updateWindowHeightWithLock:(BOOL)lockFlag {
self.lockResizeWindow = NO;
});

// MMLogInfo(@"window frame: %@", @(window.frame));
// MMLogInfo(@"window frame: %@", @(window.frame));
}

- (CGFloat)getRestrainedScrollViewHeight:(CGFloat)scrollViewContentHeight {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ - (instancetype)init {

- (void)commonInitialize {
self.screen = NSScreen.mainScreen;
self.minimumWindowSize = CGSizeMake(360, 70);
self.minimumWindowSize = CGSizeMake(360, 40);

Configuration *configuration = [Configuration shared];

self.miniWindowFrame = [configuration windowFrameWithType:EZWindowTypeMini];
Expand Down

0 comments on commit d893137

Please sign in to comment.