Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions package/src/native/macos/nativeWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6986,6 +6986,14 @@ - (void)windowDidResignKey:(NSNotification *)notification {
[wkImpl.webView setNeedsDisplay:YES];
[wkImpl.webView setNeedsLayout:YES];
}
} else if ([abstractView isKindOfClass:[CEFWebViewImpl class]]) {
CEFWebViewImpl *cefImpl = (CEFWebViewImpl *)abstractView;
if (cefImpl.browser && cefImpl.browser->GetHost()) {
// CEF zoom is logarithmic (base 1.2): 0.0 = 100%, 1.0 ≈ 120%
// Convert linear zoom (1.0 = 100%, 1.5 = 150%) to CEF scale
double cefZoomLevel = log(zoomLevel) / log(1.2);
cefImpl.browser->GetHost()->SetZoomLevel(cefZoomLevel);
}
}
});
}
Expand All @@ -7003,6 +7011,22 @@ - (void)windowDidResignKey:(NSNotification *)notification {
});
}
}
} else if ([abstractView isKindOfClass:[CEFWebViewImpl class]]) {
CEFWebViewImpl *cefImpl = (CEFWebViewImpl *)abstractView;
if (cefImpl.browser && cefImpl.browser->GetHost()) {
double cefZoomLevel;
if ([NSThread isMainThread]) {
cefZoomLevel = cefImpl.browser->GetHost()->GetZoomLevel();
} else {
__block double level;
dispatch_sync(dispatch_get_main_queue(), ^{
level = cefImpl.browser->GetHost()->GetZoomLevel();
});
cefZoomLevel = level;
}
// Convert CEF logarithmic zoom back to linear
zoomLevel = pow(1.2, cefZoomLevel);
}
}
return zoomLevel;
}
Expand Down