HISE Logo Forum
    • Categories
    • Register
    • Login

    panel - set draggable bounds to arc?

    Scheduled Pinned Locked Moved General Questions
    26 Posts 4 Posters 773 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.
    • ustkU
      ustk @Dan Korneff
      last edited by ustk

      @Dan-Korneff said in panel - set draggable bounds to arc?:

      @ustk excellent!! next question... how do you keep the panel locked to the path when you drag the panel? Right now, you can drag the panel anywhere on the interface

      Is this because you set the panel to be draggable? I think it shouldn't, since its position is script determined...
      you can replace the knob by the panel value + mouse drag, basically turning it into a slider. Although since it will move as you change the value, I don't know how the mouse drag will react, I imagine badly...

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

      1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @Dan Korneff
        last edited by ustk

        @Dan-Korneff If you want anything following a path of any shape, the solution is in this pull request which hasn't yet been merged:
        https://github.com/christophhart/HISE/pull/378/commits/779955c6b7fa27f0890c24bfaac41f063ffca92e

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

        Dan KorneffD 1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff @ustk
          last edited by Dan Korneff

          @ustk Thanks so much for the help!

          Screenshot 2023-03-24 090752.jpg

          @Christoph-Hart @ustk show me the way :)

          Dan Korneff - Producer / Mixer / Audio Nerd

          ustkU 1 Reply Last reply Reply Quote 2
          • ustkU
            ustk @Dan Korneff
            last edited by ustk

            @Dan-Korneff Yeah I've just seen the merge
            @Christoph-Hart :thumbs_up:

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

            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @ustk
              last edited by

              @ustk I'll try to make an example...

              In short, create a path, get a point along the path length (which is a 0-1 value), do whatever with the coordinates

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

              1 Reply Last reply Reply Quote 1
              • Dan KorneffD
                Dan Korneff
                last edited by Dan Korneff

                Here's my sad attempt:

                
                // Add a mouse callback to the panel to drag it along the arc
                Panel1.setMouseCallback(function(event)
                {
                    if (event.drag)
                    {
                        // Calculate the angle between the center of the panel and the current mouse position
                        var dx = event.x - 300;
                        var dy = event.y - 300;
                        var angle = Math.atan(dy / dx);
                
                        // Adjust the angle
                        if (dx < 0)
                        {
                            angle += Math.PI;
                        }
                
                        // Calculate the new position of the panel on the arc
                        var radius = 200;
                        var pX = radius * Math.cos(angle) + 300 - Panel1.getWidth() / 2;
                        var pY = radius * Math.sin(angle) + 300 - Panel1.getHeight() / 2;
                
                        Panel1.setPosition(pX, pY, Panel1.getWidth(), Panel1.getHeight());
                    }
                });
                

                drag test.gif

                Dan Korneff - Producer / Mixer / Audio Nerd

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

                  @Dan-Korneff What's the reason you want to use a draggable panel and not a knob?

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

                  Dan KorneffD 1 Reply Last reply Reply Quote 0
                  • Dan KorneffD
                    Dan Korneff @d.healey
                    last edited by

                    @d-healey I'm using a knob + filmstrip right now, but the dragging and tracking isn's as smooth as I'd like. Especially near the far ends of the range.

                    knob drag.gif

                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                      Not directly related, but with the additional path methods from the last commit, you can follow any path:

                      pointOnPath.gif

                      HiseSnippet 1126.3ocsV80aaSEE+513xrgMwj1S7jUDB4.YAmz0ARSnUZZKqZqsVjxXSHzzs123bUctWO6qaaDruC7QgOB6CDOvK7LbNWaG6rl0sEIxCQ97+e2e2iOG6mJCXYYxThg0IyRXDiOwbzLgZxvITtfbvtDiaYdHMSwRcJTsyrDZVFKjXXr9OfJLrZQz+96GtCMlJBX0pHjmJ4ArmvmxU0Z829w7338ogrS3Sa38819f.oXnLVlC3YcSORBM3LZD6HJ51ZlDiM1KjqjoiTTEKC7YGY3rQSjWHJ7+o7L9ow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2PqAvjP+kWVvm.BxNye02zzqmGYJ7UQuHH.O92EFur7XFrBwr4JDy8VgX1ZEh49qPLeyJDy2dswfeP52mqjSKdc.T3umdDrgwdBJzYo6BI+GTOtSOA
                      

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

                      Matt_SFM Dan KorneffD 2 Replies Last reply Reply Quote 3
                      • Matt_SFM
                        Matt_SF @ustk
                        last edited by

                        @ustk nice!! Watch out, weird controls ahead 🤣

                        Develop branch
                        Win10 & VS17 / Ventura & Xcode 14. 3

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

                          @Dan-Korneff Did you try changing the mouse sensitivity setting, and perhaps set drag direction to horizontal.

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

                          Dan KorneffD 1 Reply Last reply Reply Quote 0
                          • Dan KorneffD
                            Dan Korneff @d.healey
                            last edited by

                            @d-healey I did... that's the best I could get. It's also not ideal that you can click anywhere on the filmstrip (not just the image of the slider) to change the slider position.

                            knob drag 2.gif

                            Dan Korneff - Producer / Mixer / Audio Nerd

                            ustkU 1 Reply Last reply Reply Quote 1
                            • ustkU
                              ustk @Dan Korneff
                              last edited by ustk

                              @Dan-Korneff Is your attempt above working as you wish?

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

                              1 Reply Last reply Reply Quote 0
                              • Dan KorneffD
                                Dan Korneff @ustk
                                last edited by

                                @ustk That's pretty neat!!

                                My above attempt doesn't work as intended. The panel doesn't follow the mouse drag properly

                                Dan Korneff - Producer / Mixer / Audio Nerd

                                ustkU 4 Replies Last reply Reply Quote 0
                                • ustkU
                                  ustk @Dan Korneff
                                  last edited by ustk

                                  @Dan-Korneff Yeah so I think it might be related to the panel itself moving as you drag, so the mouse drag info might not be consistent...

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

                                  1 Reply Last reply Reply Quote 0
                                  • ustkU
                                    ustk @Dan Korneff
                                    last edited by

                                    @Dan-Korneff Another solution I implemented a while ago is to create some mouse masking.

                                    you define a smaller and a bigger circle, and only accept a mouse click to be valid when you click in between the two.

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

                                    1 Reply Last reply Reply Quote 0
                                    • ustkU
                                      ustk @Dan Korneff
                                      last edited by

                                      @Dan-Korneff

                                      HiseSnippet 1006.3ocsV8+aaTCE2WRuwRfALI9CvZ+vzEfdjT1Fn0UVWSSgHncQjsxpPnI26bxYUG6Cam1EMs+GF+mx+Avy1WxcoMqaDIxOb4deyuO98d9iuAJYBUqkJTPimMKmhB9jvgyDlrtYDl.0eeTvmFdHQanJrW0dyxIZMMEEDT+GsJBZrAx86ue7dDNQjPKUgPGKYIzegMgYJ0NX2elw4GPRoOiMoh22a29IRQWIWNEvS8v1nbRxYjwziHV2pEhBtQuTlQpFZHFpFErwdxzYCyjWH79eLSyNkSsBcPCgExq9.IO0hXqVT2LFOcv78sFAqxfxpPceU3KBOjkxVnurZ74NC3xHpVOBpsL7puD757tf2JfTPEHsgGR2NbXhhkaJsXwyGG1W.MmQDnrWEJdeQ09q5gckfGBS7DxYzCTfvhHhdP61eMFdzZ6lfWZImFmvoDUDnnIzKzF74DEd.QP4cv6fmuTioltxI4RAHDcGu46rbLxo1Ylcvac+1aWQMSH7paCpa5iLVSMCfBr4WgfXBZznohDCSJhF2p4qa1Xb7HXd4Ibdje1PGeJGFLf70vZTaAiUejIioiSIFRLSeLgyRwOFOOjwJJUfe3B4Th5LEM0tH90uGmyx0zne2uLvV72XolrnVa51Js9lshgh0Bi+DkMNybIqt2K96O7KcI5tB3ee40Uqdm4spU26E+Yy6ar8hJU2CkS0ztDN+TH0kkW54P+yUhsslbo9EPmwoL9U3MwWBO1Ts8BWOYgqyp35bzU3q2aN35gDSVr9OUlnHad9R6iV3uBakNwJcRKe+7p8vcfE3Q9ZpcYw28tfhevuYKxiKHEM2NDE42+y2jXo3Hog9TQjai17MMwW1znQqzlcXWI4bpZklsbWpqKvHwzImZaKmS3SoKbDNPuLKwM9vXIR7m8p3nTzWvLOMmVHe8zbnhCuvaOu+9PA1RyTnC7KmpLLKbB1mdNvY6IcZDtOUelQl67s3DOJ3iLNq2ZNkjcPCwfTeyP+PG5Ukz5mr6rpBWXmlPAgAuM.gxbyKykfAT4EyGSAn7YgvgdboBzUYEA9XY5TNwrLIs8loBCPOYIlQK6mPyLypdy0+Al61WKy8GJDuc3.lIIa0Xr1JvHzs9+.iE22cqvdiFQSLk.bivCdw5d416I8dZ9w.kfhAyIgGMcxPfYLgBYGNTy014gZ1IVubaqrsBLjJRcB+C7qvXGqbPgwNyMhlPRTxWl3OIZuQ8lNM.lDtOlnA7UMfLtCxc5DhKrcbazD3x8WljX29aBGhVcLasFw7sqQL2aMh49qQLOXMh46ViX99qMF62U8joF4D+wAPwfdNZpffdBBLY4lBQ+KObH.YA
                                      

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

                                      1 Reply Last reply Reply Quote 2
                                      • ustkU
                                        ustk @Dan Korneff
                                        last edited by ustk

                                        @Dan-Korneff With the new path methods, it is also possible to detect if a mouse is inside or outside a path with Path.contains([x,y])

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

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

                                        27

                                        Online

                                        1.8k

                                        Users

                                        12.1k

                                        Topics

                                        105.8k

                                        Posts