Detect drag direction
-
Is it possible to detect the direction a user drags the mouse?
Perhaps using event.drag?
-
@mmprod I believe there is a dragX and dragY
-
@mmprod this is an example which will detect the user drag direction and lock it to that
HiseSnippet 1028.3ocsV09ZaaDF+TRTWs25XE19x9jl+vPY3YjqkccaYzzX6rZ1bhYtsTnTJmkNIcjS2INcxwlRf8m79OX64j7KxIlzVCSfI548e44dd9cZrT3QRSERjQ0WsHgfL9FyIK3pndQXJGMrOx3aMGgSUDoUgpSWjfSSI9HCiC+csBiJGgxe9mmeJlg4djMpPn2Hndj+jFSUazN9j+fxXmg8IuhFWxa2SF5I38DLQFfmCMcPIXuKwgjywZ2NvD8RbZDx3WL638j1NSINsa20sUWW2NtcZ6D3zJXZ2NtSa8X2V9tsa50BYbuA9TkPNQgUjTHomJ7WLIRbEun.uglRmxHZglnIPkKTi5EQY9iW0bRQHiiFuoUcXQq56MGQ8oq0uok8c4Fr1DQ4llwA2EjZ9E.IiRP5nBH8PyIdRZhZiEMd9Zygb3DL.CmMkgRgunC5dnYOA3AW0HFeI4LIHrNBaWGm5VsbbN9YUqBmOoJqYXoUehh3o5Kwg8oR3Mpfa8aVqRSHQ0SDmH3ffcsc3aMc11g9FoD0XnOp9KQlhxI1AY7bC1gGW8iUqD1H.lcdAiYWyYdPfa9iNYUz1R0kUO9XW7mzFdQXoRRxRIZeBa3KwWMfwnIoD62ohnoM7wJrVcXi4+Z65V2P2BstlN5euut0ifjb8cf7QBnP8vL1TXvcCzIyf1PN7oAVERM7XTuKI9GWsRksKIzE+Xs40dpUgeyqaUawZoEWCEuTVnoZLbAms.RDj+bS+DnkD.MOe6RolJOVWrJaoBJVQhzU9sVO2Bpr0S0U7YZeuE3d2VQ+9UgeC0ZLdc9QxFjFqaMuN4F++lifLteAbyCI2pjjnGBrK52qZjVB94BE4Btcdyr50UstooffcZSOWJELFQtSyZdH4cEnMOKdJQVGF8YYj0NB6cauLeuOukYuh0jRNJ3C4T0EIjkxmIX95kT862d0GsbOCd60C6CcRMavRcfeIDohpgiQexLf+sfanhYeR5kJQRtuKWNQFekJ25CVwbf4DFhBk9GL2wTNZdY95EkEth5qhVq3umcRDgFFUh2mdBrYHtZ09AfuezrmdMHst0KEyfqX9YKcwBo7P3VhaQtAzpB+LFVsMWq9VnkFz.rLAmlDimRUKJeK0W.ArycR.+4BwGZNlp7h1MFOXGXDNM++.iKu15AlCBBfSyM.7Hyyd69dG0mn7Ez3givJIEFcLOOKdBPL6QfpygIMH4lFGnmnKjczx5NvDB2OW3egmkFapkMVZr4JinXrmT7AuhMU8Ei2OWCfId9GNTA9BFP1pIJe6sbeNFtm9CddampaE3i12.asuA5tuA1deCry9F3i22.69oCT+YTuHSIhKVaPnQiGjS2YXLfigIv7oUz+AvewOLA
-
Thanks - this should have been clarified- I’m trying to get a sort of “isDraggingUp” or “is dragging down” boolean value. I want to detect which direction the mouse is being dragged. This way I can do something based on if the mouse is going up, down, left, right
-
@mmprod Oh, I see, well I think it's possible to script, let me think about it
-
@mmprod just keep in memory the last values for
x
andy
and compare them with the current ones.-> if previous
prevX
is smaller than currentx
then you are going right, and vice versa
-> if previousprevY
is smaller than currenty
then you are going up, and vice versa
-> From this you can set the bools you needgoingRight = x > prevX;
, andgoingDown = y > prevY;
-> update the memoryprevX = x
andprevY = y
for the next call -
@ustk thanks, this makes sense
-
@mmprod Here's an example
It display the last moved direction, if you want the directions like: south-east or north-west etc, you need to log both x and y at the same time
HiseSnippet 1149.3ocsV0saaaCElJIZa1aEaEn8lcEqtXPdvyPtVNMqAcMI1IqAqIwXNsn.CCEzRTRDghTPhNwBAAXup6MXuAaGJ4ejSbZ2LVEPP74Od93GO7b3fToGMKSlhLpeddBEY7UlCyEpndQDl.cbejwWa1OkD1mkR8TLo.cPdBIKi5iLL17m0NYTaKTw2e8xCHbhvitPEB8VIyi9ZVLSsP6f89EFmeDwmdNKth2t6crmTzSxkiA.sooCJg3cAIjdJQ61FlnWQxhPFeu41d+XWmQTmtc2wsyNtta6tcWm.mNAi1Ya2Qcd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3WH72v2Tis0xFSM1dlQTLwKU9duxam5Ws7EEZ.LIJdgWMySzx31nharU44X3QTu2ya4k5NA9z0MvNqaftqafcW2.2dcC7Yqaf67wCT+F28GCO.o7ZCBcxfCKZ2YXbnf.UfEUqn+QevR4R
-
@mmprod This is awesome- exactly what I needed (thank you!)