Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GetMouseGesture(MultiAxis := false, reset := false) {
- Static
- if (MultiAxis) {
- mousegetpos,xpos2, ypos2
- dx:=xpos2-xpos1,dy:=ypos1-ypos2
- ,( abs(dy) >= abs(dx) ? (dy > 0 ? (track:="U") : (track:="D")) : (dx > 0 ? (track:="R") : (track:="L")) )
- ,abs(dy)<4 and abs(dx)<4 ? (track := "") : ""
- ,xpos1:=xpos2,ypos1:=ypos2
- ,track<>SubStr(gesture, 0, 1) ? (gesture := gesture . track) : ""
- ,gesture := reset ? "" : gesture
- Return gesture
- } else {
- mousegetpos, xpos2, ypos2
- dx := xpos2 - xpos1
- dy := ypos1 - ypos2
- if (gesture = "") {
- if (abs(dx) > abs(dy)) {
- axis := "h"
- } else {
- axis := "v"
- }
- }
- if (axis = "h" and abs(dy) >= abs(dx)) {
- track := ""
- } else if (axis = "v" and abs(dx) >= abs(dy)) {
- track := ""
- } else {
- if (abs(dy) >= abs(dx)) {
- track := (dy > 0 ? "U" : "D")
- } else {
- track := (dx > 0 ? "R" : "L")
- }
- }
- xpos1 := xpos2
- ypos1 := ypos2
- if (track <> SubStr(gesture, 0, 1)) {
- gesture := gesture . track
- }
- gesture := reset ? "" : gesture
- Return gesture
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement