Skip to content

Instantly share code, notes, and snippets.

@cptSwing
Created October 1, 2021 14:31
Show Gist options
  • Save cptSwing/3947adef7431322d85638a31192a88d9 to your computer and use it in GitHub Desktop.
Save cptSwing/3947adef7431322d85638a31192a88d9 to your computer and use it in GitHub Desktop.
I added this in StrokesPlus as an application only script, and set the gestures to react to middle mouse button, left and right 'swipe'
// last element in array
var lastGesturePointInArray = action.GesturePoints.Length - 1;
// pixels travelled
var distanceTravelled = action.GesturePoints[lastGesturePointInArray].X - action.GesturePoints[0].X;
// Edit if need be:
var horizScrollDist = 1.5;
// turn to absolute num
if (distanceTravelled < 0) {
distanceTravelled *= -1;
horizScrollDist *= -1;
};
horizScrollDist *= distanceTravelled;
//sp.ConsoleLog('\n');
//sp.ConsoleLog(action.GesturePoints[0]);
//sp.ConsoleLog('traveling left: ' + distanceTravelled);
// X axis value started out at
var startX = action.GesturePoints[0].X;
// M.Wheel-scroll-to, horizontally, by n pixels
sp.MouseWheel(new Point(parseInt(startX + distanceTravelled), action.GesturePoints[0].Y), true, parseInt(horizScrollDist));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment