HISE Logo Forum
    • Categories
    • Register
    • Login

    LAF slider moves when clicked, but not the way I want

    Scheduled Pinned Locked Moved Scripting
    4 Posts 2 Posters 129 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by d.healey

      I'm sure this is some simple calculation but I haven't figured it out.

      I have a vertical slider. The value is represented by a rectangle. When you click on the rectangle it should move so that its middle is aligned with the mouse cursor, but it doesn't. Any suggestions?

      HiseSnippet 1019.3ocsV0saaaCElxILaV6GzNzG.hbkylqgcZV6.BFpyetvnItdUIACnnnfVhxh0TjFRTI1sn.6h8tr61qvtbOG6MXuAaGRIaotXj1ZfYfD3yu76b347QOLQ4yRSUIHm5mOeJC47kXu4RczQQTtD0+XihTAOfknYoZzgymRSSYAHGmMdhwCm5ahre96GeHUPk9rRUHzkJtO6TdLWWpcX2mxEhdz.1473JduW299J4QJgJCPyF31noT+IzwrATia0vHmsNIfqUIdZJ.FvmCUAy8hTWKy8+RdJejfYD5f7fDkqFcTDWDLbQklhPNaNrrt2HutuG9Ld.eo9x5+NVCjxHp1CbpcaPpym.jbp.oMygzcwd9I7o5RKF77E39RMKIjBs5pPI2WTsKpgORAdH0shoSX8R.gkQz3gsa2j.+am8ccg1cplHngjejrHD+DFTImp7ohSUpIGHC5wXhFF2AGakvFySgb0KS5q4JYisCRnWeJWxnId1wjsaRBWXbbShZzq2w8st0uhlPnv4.xsnvYruac25iaEBiBGHDMLpGMN+xemBaoLctBqUtlEmK1I2ASFifLRewCdI4aIsas694JmuP48WXyD+UTQFafJIlJ3ugE.FiHeG72Jstec2En64LeciWraSx7lP510j08ZRhdI.h2Y5JEcwmJUi5ToON1.93oJIHzXaq0sA2sewTY2nCCcWv9hVGQIGnzrmIaX6dtuyk7eMEFtRaF.jnDBVxJMa14Rts.aHyhGwRZRrsjkNBCku+j9VebS5948iJNpj8kb8ylxJj6oDAlIXy2u4dApngZ1PJPH3p1te70E6G4CdHNjjOCa6vHK3qRNgtn+wTMcQZfLBmxTfUiaJFmiYWALU4qc0wGyRmnUSs9VbGB7.evCc1xC7W9otyKO8AcS0yMsFW7klSDt4Qw7f.AanJkaZ+UP5e.qWS8fgPit2due+I+0a90GGWkoEghoypVaoYgg7YVJRXhMNUC3qeLvbhb9F7EoLR.KjlIzjzIPdDb4DVv4Jq+WyCzQU4fiX7wQkr0c4cSgqtyYyzGplYnYJ2CAm1Bg9yeKmU+FrW.uoJHSP0uOYp4UiBClBuJClgkRBMj4UKtOAF112JC6GKDuKdHW6GsZLVaEXDlo9+.iEuK8U3SBCANnR.tIt2OutOB8AN9mqxzb43ynvHDbaiGjE6A2z9L3zkRl.RN1olYqLWtsQ1zA7Xx.qv+.eJL1wH6TXryBivvqeh5U946xlW99bqF.SR6C80wmYjIKWhw31sZaVX3ux22T92uCBs5X1cMh4AqQL6sFw78qQLObMh4QqQL+vsFi42+bPlVEmuN.JFdhkL0w4DIElrrSgn+E.sNN+.
      

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      ustkU 2 Replies Last reply Reply Quote 0
      • ustkU
        ustk @d.healey
        last edited by

        @d-healey AFAIK you can't. Because the mouse 0-1 is mapped onto the full height while the rectangle travel is full height minus rectangle height, meaning there will always be a "sliding" effect. This is because you can't have the mouse position to play with. So if you really need it this way, you'll have to go with a custom panel

        Can't help pressing F5 in the forum...

        d.healeyD 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @d.healey
          last edited by

          @d-healey BTW your y can be factorised this way:

          var y = (a[3] - h) * (1 - obj.valueNormalized);
          

          Can't help pressing F5 in the forum...

          1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @ustk
            last edited by

            @ustk said in LAF slider moves when clicked, but not the way I want:

            @d-healey AFAIK you can't. Because the mouse 0-1 is mapped onto the full height while the rectangle travel is full height minus rectangle height, meaning there will always be a "sliding" effect. This is because you can't have the mouse position to play with. So if you really need it this way, you'll have to go with a custom panel

            Thanks for the clear explanation. It explains why I couldn't figure it out :)

            var y = (a[3] - h) * (1 - obj.valueNormalized);

            Oh that's much nicer

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            11

            Online

            1.8k

            Users

            12.0k

            Topics

            104.8k

            Posts