Little help please: Make viewport scroll with keypress
-
@d-healey this is my go for it, but the scroll thing make my head hurt 🫣
HiseSnippet 1663.3ocsXstbaTCEd2jrkZCEnL7.H7.yrtwwc2buIDxEmj1Lso0SbHkY7jonrqrWMYsjQqbRMcBCOH7vviTeCfizd0NNkPf5er514x24niN5H2Tv8HQQbggYoiG1mXX9YVsFxjAMBvTlwA6ZX9IV93Kn9F6LrONJh3aXZN8SUKZVZFC8u2u4N3PLyijOkgwIbpG4EzdTY9rM254zvv8w9jio8JP8hacfGm0fGxG..YZKGi9XuywcIuDqHaJKCy6smOUxEsjXIIxvblc39CaEvujES+IzH5YgD0.WiVffhmdednuBwpYMZDPC8alZvQFfTZla9SGa9es0gTeZ174tguTu.Jmih9CyoFEdSOB7bKBOmBvaBPxr.jlIFROzpkmf1WluhBOep0ALIQzACt8hPIlViod+8sZvAJXx58vmS1W.Cx3vdYGmZH3S00KWFb8QRzQu50u4Y6cvSe1wnMPKr55EltUysarGL6JYDGRgOafZW4.IoGxsRMTbu4y5sPVuEy5sTVuky5sRVuUy58jrdtN4cy0hatZby0iathbWpxoYX8Br.cBkbYetP5BfN0qzkHav60myfA1UxnnR00m.iy+Ox37UpNhJS1yvLR3Mq0hDo3u3359XItNErmHfekGer0iHfDBHztARvxUDTOjv5JCPOBYWX6b17Mwpn4JL.v63BrIDtKOhOPRYD6NCXdRJmY2sZ42Utjxpv.TjAzHkc7BtGNbG9.lejsJPRSf.6SGDUfJ6JmwE9DwQ5ETFYoxk5vEHaJPky5HJ56iIN2dSrCXsYmsZ4RftyTdaHtk9ALvZYJ90TeYfMLQNkPPQIP6kncP1ojcBNb.wtJZiMPTPWkJ0U4GhyEYmaDJbEOYkpJanDILhLN4wMQ0ujJC1Nre.tf.NqaJ60JXtA7KHBstQahbq6fVC4Te4XMnPZ25cfLlGobxD+iHdRLqaHwFWKwQW8VXQu61XUymXV2jFaia6bZMDtsK7cIUmENE58tFbAiHZQ+UxZIPBb3wLuVa2ZHX6R88zqzR+pxku8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uAJYcnZLJKopkkScGidva0eimmx7mCRfOYdl+NvyB2AdV7NvyR2AdV9NvyJ2AdV8Cxi5uIY6ARdu3iCvDM2Seujo4dLLDYoiBM9a.xxVLO.
-
@ulrik What does yours do that's different to mine?
-
@d-healey your jumped 3 values for each cursor down or up, I guess you forgot the return true?
-
@ulrik Just moves one line here
-
@d-healey In the keypresscallback
-
@ulrik Yeah that's what I'm doing in my animation.
You can see in the code I only add one or subtract one, never three.
-
@d-healey Yeah, I know but...
HiseSnippet 1683.3ocsX0uTabCD+NfKM1sIsoSe.T8z+3bvXtiuSHD9vPR7jPhGLkzNdXRE2I6SCmkbuSFhaF5zGj9vzGo7FztRmtOLwjPoM7G9jVse7aWsZ0JZEw8Hww7HCyRGNZ.wv7qrZOhIBZDfoLil6ZXdWq8wwBRDJgzNiFfiiI9FllS+TIAyRyXn968atCNDy7H4jLLNhS8Huf1mJxo1ZqmSCCeB1mbHseAtWZqldbVCdHeHfmosbLFf8NE2i7RrjsorLLu0d9TAOps.KHwFlyrC2eT6.94rD9OhFSOIjHm3ZzFTTB4mvC8kHVR0nQ.MzuUpeGa.ZoUdTX5jnv2YsO0mlQOOZ7MpEP4RTLdXN03va5wfmaQ34T.dS.RlEfzLIP5dVs8hnCD4qHwyWZ0jAaNcwPXuHTR30XpUKY0fCbvD06iOk7jHXRlD1q33TCA+Tc8xkgPer.cvqd8ad1dMe5yNDsAZw0Vu.41s1twd.0UyXNjB+rApSklBRejakZnjQKjMZwrQKkMZ4rQqjMZ0rQqkM5AYibcxGlaE2by3laG2bC4tbkiyv5Y3HzQTx4C3QBW.zoQkdDQCd+AbFLwtRFGUpt9DDbgOofKTo5XlTumgYjvq1pEYRJew408wBbcJ3Owf7xH9kVOl.ZHfP6EH.OWxP8PBqmH.cejcgsyYy2DqhlqvD.uWVgsfzcwA7gBJiX2cHySP4L6dUK+txkjdEFfhHfFK8iWv8vg6vGx7iskIRJFhv9zgwE3xtxI7HeRzApEjNYoxk5xiP1TfKm0QTziR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AiBxU9Zu4cEwu+3W+uG+TkHLL+cqjNpuS4jF70eWT+cI82k0eWQ+cU820zeef9qqS5fTM5lpR2Tc5lpT2kMfZpu.ZrEx6lBKuituJ.cKK4Euv6I+f2JAuRi6OLDKF+oax2qpW.pAL16kjuIhESEiJdF3+s2yccg38rZQEdASFiSMALJKY7Y.i5WAeGq851E58KGfyX8je5yySdMRdtQO3VuHJjPa8xg8aCM84Q.qyfikxZvlxyX54Nx4xHPaByWM4ug+zK5JmapWzMcQi9XHY+MdIkGkuy91JJ.lXp+ECkr1WNGkUT0xxotiQe3I+uwyS59yAEvmrLKbCjYwafLKcCjY4afLqbCjY0afLq8QkQ9eaY6gBd+jiC.gV6otWxzbOFFxrTYgF+C.LVjD7
that's why I commented on it :)
-
@ulrik But it works in my snippet without returning true...
-
@d-healey ok
-
@ulrik I'll have a glass of whatever you're having :clinking_beer_mugs:
-
@d-healey You should always return true in a keyPressCB, Chris recommendations :)
Or troubles are knocking at the door... -
@ustk Aha well that's different, in that case I shall do it.
-
@d-healey Is there a particular reason you aren't actually using a child panel paradigm here? (even if not relevant to the problem described)
-
@d-healey the first and most simplistic way is this:
HiseSnippet 1741.3ocsXstTabCEdWfMM1sIsoSe.T8zerNXb7x8DBgKFRhm.AOXJoY7vjJ1U1qFVK4tqLD2LoSeP5CSee5exaP6QR6MC1ITZC+vqtbt7c9zQGIQyPtKIJhGZXV3ng8IFlekUqgLgeceLkYzXGCy6ZsONRPBQ5g1dXebTDwyvzb5mIGvrvLFp+9vFaiCvLWR1PFFGyotj8n8nhrQat4KnAAOE6QNh1KmzKtYCWNqNOfO.vyzV0L5icOC2k7RrTrorLLu0tdTAOrk.KHQFlyrM2aXKe9ELs7GSinmFPjcbLZAFRO7S4AdRDKG0ntOMvqYRbGY.VoYFKLslE9Nq8odzzwyXiuQMAJSi77g4TiBuoGAdN4gWsbvaLPxLGjlQCo6Y0xMj1WjMiDOeoUCFr3zACzddnnk0Xp+pfUcNHASTsG9LxSCgNoZXubsZ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vhTV.bFBJgsxVRnduUQZAxiOP84QuFhEXPfHrycd3bN53N6nK0QmmCcaxinRa9Z3DTo9ffPhyD9KE.b1K4BxALak2AMPWdpNcF6bxaAHwNIbrSKuUb3GSQaHm+TRXEcRPpfvUEG89mVS99m4udrq9RI4DjyZvnhC5SXS5RyFw2jAtq5TwnBDUnto52FeSUhWBUaP8jWUMk4MT.O+6DL9Waj4urQ9vFF+Xicf7Y48migG.49jPAUxFl6PNGdLh91zEr1gDclf2Wg+3ahYX9EW6H3sYN9IaNLqyNadg7ZBoC7mgapubV5H+r+l5T2swgG4CahX.olYfeXSI5SQzs0H5NV4pgn.ycyOxH3wvXX9NihGTN7bq+XJsH8wgfyx407QJTlheQRwJ.nes0VAAnrALxoWwq8h2D3ue+W9uyepBWFl+lk9U.2on9QIweWH96hweWJ96xweWI96pweeX7WmZIMRrnShIcRroShQcVx.pvuGT7Ax6lBKuLPOEAcKK4I7vafux66fWVx8FDfEi9bS4arim.pALxa7juiiAEtFleOv+auA85Bw6Y0jJb8GOFmZLXTVx3y.Fie49cr1sSG3RlY.bFqm9Seddltg9cMcgyfCoPBs0KGzqEb6RWB3cFrsTVC1TtGKteMYeICzhv7Tc9a3u3Icj8MimzIYRidXHY+Mt5xix+2.2VMBfIl5eKRAq8k8QoEUsrpUslQOpG8MttxveNn.930Y9afNKbCzYwafNKcCzY4afNqbCzY0OpNx+CQaMPv6o2N.CzbW04Rll6xvPlkJKz3e.sU1ehB
Now the slowly shifting position isn't particularly nice visually speaking
It would be better if it can stick to the bottom when going down and oppositely when going up... -
@ustk said in Little help please: Make viewport scroll with keypress:
@d-healey Is there a particular reason you aren't actually using a child panel paradigm here? (even if not relevant to the problem described)
What I'm doing isn't dynamic so a child panel has no advantage for me and would just be more complicated.
-
@ustk said in Little help please: Make viewport scroll with keypress:
@d-healey the first and most simplistic way is this:
Now the slowly shifting position isn't particularly nice visually speaking
It would be better if it can stick to the bottom when going down and oppositely when going up...Yeah that implementation I already had :)
-
@d-healey I was sure you came to this too :)
-
@d-healey A bit better but it's not ideal
HiseSnippet 2001.3ocsXstaabbEdWYuFgLwoIE4AXJQ9wxHRpckrjbrrikDkTrPjrIDUUZfff6ncGRNvKmgc2gTV0PEEnuF4G4gn+u8EnuK8Mn8blYuQJJYUgF9Ctyky0u4bNykNwx.VRhL1xtxwWNhYY+YNcuTnFzd.kKr1eGK6O24PZhhESLCs8kinIIrPKa6G783.1Udnk92+9kaSinh.VwPVVmH4ArC3C4phQ6r4Ovih1iFxNlOrD0OYy8Cjh1xH4Xvddfim0HZv6n8Yulhjsfik8i1MjqjwcUTEKwx9gaKCur6.4EBC8mvS3mGwvN9VcAAYFdOYTHZw3nVsGviB6j42IVfT5TfBOvfBekyg7Pd93EnwWnmfTvQY7vdgoMuGLk44W177JYdywjrKYROzXReoS2fX9HUwLn87oN6KfEmdT.1KaJFZsV34elSaIPgP0ZH8cr8hgN4b3tlmWCB7W8MpVEf9DE4n27iu8U6t+2+piIufrxS2nzvc6rU6cgQWOm3HN72KHmVaeEaHwuVCho0x4sVIu0SxasZdq0xasddqml25aya46UzrPK9EpwuPO9EJxe0ZmkaqSnwjS3rKFIiU9fQmgJ8Yp1xgijBniasbJpUei4v3xeTFWtV8oTY5ZFUvhtYsVlHj+x8aERUzVbveR.9QDel4SXfDFv38Gn.OGInUDSzWMf7MD2RKmKVrHVmzrTGvdgeyJyNPDu5H4XEWvb6MVDn3Rga+5U+P0JniQAqQMfmftxAx.Zz1xwhvDWLVRSPLMjONoDUt0NWFGxhOROA5mUpVomLl3xAp71fvIO2PbgKm5JvbKtX8pU.cmq7SgPW9s3iMxU7OxCUCbgAJnDhKp.ZuBuGwMirSnQiYt0Iu3EDNnqJU5i3fobjagSf1kYvZ0QenBKJgMK4lOIstfqFrUznAzRB379Yr2nj6NPNApwh5l7RheKOxyHdsVynAzR62pGTz7HDjYgGwBTTQ+HlKsQJPW+N3Qe3t3UKm5V2jFOkdp2YMHzS8g+WEarxYPqOzVFKXwc4+Y1yRMI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eFuo4z94i7GGrooJ31z3iG.0YD.nVHfudyoxPwI9a+hnyvM9W+Czsl0TerSo5jZq7yKOxTFpk0kk6LsgRJYnO5mWvPxHZLnrRZsLD.arJuHa6UvC9MNaEEQJFvpDeUuyqp2.v9W+SY.qicCaKqLa0w9uCyd6.pdKVK6+hi4dlOtp4ZuoeWI86SR+tZ520R+td52ml98aS+56k0HSh9YhzOSl9YB0eUK3rHG.kqg.wEn3wVGpAlG4fmE0x55ufvW3bnLbbDUM8CZfuhS5DP7wTuh.9RABHt4xxuxy+2dki6pI9kNc3pfAy2FWXN1HVC4WAaL8sgdryt85AWGpv.enyd+gecdHHKyMv6CmVLlCAxNud7vtv8fBXf1EP5HVT1FysR66g8QDnKSDp67efeoS5i8sSmzOaRqgTHX+sAl5k3qO8I5Q.aRne3sJNGh8I4UYcb7Z4YMjGxeaP.59MgJ5ymmkuG7rx8fmmbO3Y06AOqcO3Y86AOO8V4AeCxsFqjCMoCv.c1UuQks8tBJDYoiBs9uPuhOje
I have another idea in mind
It would be a bit like this solution but indexing the Y position only betweenvisibleItemsInt
andlist.length-visibleItemsInt
instead of moving it continuously...
It's not easy to explain but I'll try tomorrow if I have the time -
@ustk Thank you for the help!
-
@d-healey I'd like to have a look at the C++ behind a viewport list as it might be useful
EDIT: some interesting stuff in
juce_Viewport.cpp