HISE Logo Forum
    • Categories
    • Register
    • Login

    MidiOverlay Drag but not Drop

    Scheduled Pinned Locked Moved Scripting
    3 Posts 1 Posters 44 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.
    • rglidesR
      rglides
      last edited by

      Does anyone know if there's a way to script a MidiOverlay so it won't allow dropping of .mid files, whilst still allowing dragging .mid from it

      Thanks!

      rglidesR 1 Reply Last reply Reply Quote 0
      • rglidesR
        rglides @rglides
        last edited by

        I've tried this but totally guessing

        {
          "ProcessorId": "MIDI_HK3",
          "Index": 0,
          "FollowWorkspace": false,
          "AllowDropping": false
        }
        

        maybe someone knows the words to use here. Or I was thinking I could add a mouseCallback to a LAF and add some kind of if statement to check if the mouse is holding a file but I wouldn't know how to a achieve that kind of check

        1 Reply Last reply Reply Quote 0
        • rglidesR
          rglides
          last edited by

          Solved. Bit of a workaround but simpler than I expected

          const var pnl_DETECT = Content.getComponent("pnl_DETECT");
          const var tile_DRAGROP = Content.getComponent("tile_DRAGROP");
          const var pnl_BLOCK = Content.getComponent("pnl_BLOCK");
          
          pnl_DETECT.setMouseCallback(function(event)
          {
              var w = this.getWidth();
              var h = this.getHeight();
              var isMouseOver = (event.x >= 0 && event.x <= w && event.y >= 0 && event.y <= h);
          
              var isDragging = event.drag || event.mouseDown || (event.x != this.data.lastX || event.y != this.data.lastY);
              
              this.data.lastX = event.x;
              this.data.lastY = event.y;
              
              if (isMouseOver && isDragging)
              {
                  pnl_BLOCK.showControl(false);
              }
              else
              {
                  pnl_BLOCK.showControl(true);
              }
          });
          
          1 Reply Last reply Reply Quote 3
          • First post
            Last post

          25

          Online

          1.8k

          Users

          12.1k

          Topics

          105.8k

          Posts