Forum
    • Categories
    • Register
    • Login

    Prevent Waveform Floating Tile paths clipping at the tile bounds

    Scheduled Pinned Locked Moved Newbie League
    1 Posts 1 Posters 11 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.
    • dannytaurusD
      dannytaurus
      last edited by dannytaurus

      Posting this in case it helps anyone else. I just banged my head against a brick wall for too long before I realised how simple this was! 😂

      When using a Floating Tile with content type Waveform (to display the waveform of Sine Wave Generator or Waveform Generator, for example) the default waveform path is a filled shape.

      You can override this with LAF function drawAnalyserPath and draw a line path instead of a filled path:

      laf.registerFunction("drawAnalyserPath", function(g, obj)
      {
      	g.setColour(Colours.white);
      	g.drawPath(obj.path, obj.area, 5);
      });
      

      However, this means that the path is clipped at the bounds of the floating tile, especially at wider line thicknesses:

      CleanShot 2026-01-14 at 23.30.35@2x.png

      To prevent the clipping, I fudged around with it for longer than I want to admit before I realised the answer is to simply reduce the area that the path is drawn in, by half the thickness of the path:

      laf.registerFunction("drawAnalyserPath", function(g, obj)
      {
      	g.setColour(Colours.white);
      	g.drawPath(obj.path, obj.area.reduced(2.5), 5);
      });
      

      Voila! No more clipped paths! 🙌 Top row is using obj.area, bottom row is using area reduced by half line thickness:

      HISE-Unclipping-Waveform-Paths.gif

      You might want the left/right of the path to bleed out of bounds, in which case change the reduction from all-round to y-only:

      obj.area.reduced(5) 👈 all-round
      obj.area.reduced(0, 5) 👈 y-only
      

      Note: you might need to compile with HISE_USE_SCRIPT_RECTANGLE_OBJECT=1 for the reduced and other Rectangle helper functions, as per the docs: https://docs.hise.dev/scripting/scripting-api/rectangle/index.html. Not sure if it's still the same, of it's built-in to all new builds.

      Meat Beats: https://meatbeats.com
      Klippr Video: https://klippr.video

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

      14

      Online

      2.1k

      Users

      13.2k

      Topics

      114.8k

      Posts