Skip to content

Commit 08b3951

Browse files
committed
release: 1.3.6
fixes lag issues when scrolling
1 parent d82971a commit 08b3951

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/java/net/ccbluex/liquidbounce/mcef/MCEFBrowser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public class MCEFBrowser extends CefBrowserOsr {
8282
private int clicks;
8383
private int mouseButton;
8484

85+
private final boolean isMacOs = MCEFPlatform.getPlatform().isMacOS();
86+
8587
public MCEFBrowser(MCEFClient client, String url, boolean transparent, int frameRate) {
8688
super(client.getHandle(), url, transparent, null, new MCEFBrowserSettings(frameRate));
8789
renderer = new MCEFRenderer(transparent);
@@ -293,7 +295,7 @@ public void sendMouseRelease(int mouseX, int mouseY, int button) {
293295

294296
public void sendMouseWheel(int mouseX, int mouseY, double amount) {
295297
// macOS generally has a slow scroll speed that feels more natural with their magic mice / trackpads
296-
if (!MCEFPlatform.getPlatform().isMacOS()) {
298+
if (!isMacOs) {
297299
// This removes the feeling of "smooth scroll"
298300
if (amount < 0) {
299301
amount = Math.floor(amount);

src/main/java/net/ccbluex/liquidbounce/mcef/MCEFPlatform.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,30 @@ public boolean isMacOS() {
4848
return this == MACOS_AMD64 || this == MACOS_ARM64;
4949
}
5050

51+
private static MCEFPlatform platformInstance;
52+
5153
public static MCEFPlatform getPlatform() {
54+
if (platformInstance != null) {
55+
return platformInstance;
56+
}
57+
5258
var systemInfo = new SystemInfo();
5359
var platform = SystemInfo.getCurrentPlatform();
5460
var processorId = systemInfo.getHardware().getProcessor().getProcessorIdentifier();
5561

5662
var isArm = processorId.isCpu64bit() &&
5763
processorId.getMicroarchitecture().toLowerCase(Locale.ENGLISH).contains("arm");
5864

59-
return switch (platform) {
65+
platformInstance = switch (platform) {
6066
case WINDOWS, WINDOWSCE -> isArm ? WINDOWS_ARM64 : WINDOWS_AMD64;
6167
case MACOS -> isArm ? MACOS_ARM64 : MACOS_AMD64;
6268
case LINUX -> isArm ? LINUX_ARM64 : LINUX_AMD64;
6369
default -> throw new RuntimeException("Unsupported platform: %s %s".formatted(
6470
platform, processorId.getMicroarchitecture()
6571
));
6672
};
73+
74+
return platformInstance;
6775
}
6876

6977
public boolean isSystemCompatible() {

0 commit comments

Comments
 (0)