Fix mac infinite scroll bug when using standard mouse
This commit is contained in:
1 parent
94f40cd337
commit
32e8447daa
10 files changed
+11
-62
No files matched your search
@@ -92,45 +92,7 @@ if (os.platform() == "win32") {
|
||||
|
||||
// Mac Shortcuts
|
||||
} else if (os.platform() == "darwin") {
|
||||
const icon = path.join( __dirname,"/superalgos.ico");
|
||||
const createShortcutCommand = `chmod +x ${name}.command & cp ${name}.command ~/Desktop/${name}.command`
|
||||
const installFileIconcommand = `npm install fileicon`;
|
||||
const changeIconCommand = `./node_modules/fileicon/bin/fileicon set ~/Desktop/${name}.command ./Launch-Scripts/superalgos.ico`
|
||||
const unInstallFileIconcommand = `npm uninstall fileicon`;
|
||||
|
||||
try {
|
||||
// Create .desktop shortcut file
|
||||
fs.writeFileSync( `${name}.command`,
|
||||
`#!/bin/sh
|
||||
cd ${__dirname}
|
||||
cd ..
|
||||
node run
|
||||
"$SHELL"`,
|
||||
);
|
||||
|
||||
// Place shortcut in proper folders
|
||||
execSync( createShortcutCommand,{ timeout: 30000})
|
||||
|
||||
// Remove temporary .command file
|
||||
fs.unlinkSync( `${name}.command` )
|
||||
|
||||
//Install fileicon utility
|
||||
execSync(installFileIconcommand, {stdio: 'inherit', timeout: 30000});
|
||||
|
||||
//change Icon
|
||||
execSync(changeIconCommand, {stdio: 'inherit', timeout: 30000});
|
||||
|
||||
//Un-Install fileicon utility
|
||||
execSync(unInstallFileIconcommand, {stdio: 'inherit', timeout: 30000});
|
||||
} catch (error) {
|
||||
console.log('');
|
||||
console.log("There was an error installing a shortcut: ");
|
||||
console.log('');
|
||||
console.log( error );
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Shortcuts added successfully!");
|
||||
console.log( "Automatic shortcut creation is not yet supported on Mac. If you would like to see this feature add, message @harrellbm on telegram or discord to ask how you can help!")
|
||||
|
||||
// Misc Operating System
|
||||
} else {
|
||||
|
||||
@@ -175,7 +175,7 @@ function newRateScale() {
|
||||
}
|
||||
|
||||
function onMouseWheel(event, autoScale) {
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && Math.abs(event.wheelDelta) < MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD) {
|
||||
let sensitivity
|
||||
if (event.delta < 0) {
|
||||
if (event.shiftKey === true) {
|
||||
|
||||
@@ -251,7 +251,7 @@ function newTimeFrameScale() {
|
||||
}
|
||||
|
||||
function onMouseWheel(event) {
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && Math.abs(event.wheelDelta) < MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD) {
|
||||
let sensitivity
|
||||
if (event.delta < 0) {
|
||||
if (event.shiftKey === true) {
|
||||
|
||||
@@ -126,7 +126,7 @@ function newTimeScale() {
|
||||
}
|
||||
|
||||
function onMouseWheel(event, autoScale) {
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && Math.abs(event.wheelDelta) < MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD) {
|
||||
let sensitivity
|
||||
if (event.delta < 0) {
|
||||
if (event.shiftKey === true) {
|
||||
|
||||
@@ -206,7 +206,7 @@ function newViewport() {
|
||||
if ((event.ctrlKey === true || event.metaKey === true)) { return }
|
||||
let morePower = 1
|
||||
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && Math.abs(event.wheelDelta) < MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD) {
|
||||
let sensitivity
|
||||
if (event.delta < 0) {
|
||||
if (event.shiftKey === true) {
|
||||
|
||||
@@ -138,7 +138,7 @@ function newPicker() {
|
||||
|
||||
function onMouseWheel() {
|
||||
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && Math.abs(event.wheelDelta) < MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD) {
|
||||
let sensitivity
|
||||
if (event.delta < 0) {
|
||||
if (event.shiftKey === true) {
|
||||
|
||||
@@ -212,7 +212,7 @@ function newLayersPanel() {
|
||||
|
||||
function onMouseWheel(event) {
|
||||
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && Math.abs(event.wheelDelta) < MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD) {
|
||||
let sensitivity
|
||||
if (event.delta < 0) {
|
||||
if (event.shiftKey === true) {
|
||||
|
||||
@@ -124,7 +124,7 @@ function newListView() {
|
||||
|
||||
function onMouseWheel(event) {
|
||||
|
||||
if (IS_MAC) {
|
||||
if (IS_MAC && Math.abs(event.wheelDelta) < MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD) {
|
||||
let sensitivity
|
||||
if (event.delta < 0) {
|
||||
if (event.shiftKey === true) {
|
||||
|
||||
@@ -69,6 +69,7 @@ const MAC_AMOUNT_FACTOR = 5
|
||||
const IS_MAC = navigator.platform.toUpperCase().indexOf('MAC') >= 0
|
||||
const MAC_ZOOM_SENSITIVITY = 5
|
||||
const MAC_SCROLL_SENSITIVITY = 20
|
||||
const MAC_MOUSE_WHEEL_INFINITE_SCROLL_THRESHOLD= 120
|
||||
|
||||
const DEBUG = {}
|
||||
|
||||
|
||||
+2
-16
@@ -53,19 +53,5 @@ if (os.platform() == "win32") {
|
||||
|
||||
// Mac Shortcuts
|
||||
} else if (os.platform() == "darwin") {
|
||||
// Remove .desktop files
|
||||
let command = `rm ~/Desktop/${name}.command`
|
||||
exec( command,
|
||||
function ( error, stdout ){
|
||||
if (error) {
|
||||
console.log('');
|
||||
console.log("There was an error uninstalling shortcuts: ");
|
||||
console.log('');
|
||||
console.log( error );
|
||||
return;
|
||||
} else {
|
||||
console.log('');
|
||||
console.log("Shortcuts have been uninstalled successfully.");
|
||||
}
|
||||
});
|
||||
}
|
||||
// Uninstall Mac shortcuts here once they have been added.
|
||||
}
|
||||
Reference in new issue
Block a user