Class GridMetrics

java.lang.Object
heronarts.lx.studio.ui.timeline.GridMetrics
All Implemented Interfaces:
LXClipEngine.Grid.Listener, Lens.Listener

public class GridMetrics extends Object implements LXClipEngine.Grid.Listener, Lens.Listener
A set of parameters controlling grid lines, adaptive vs fixed, etc. Listens to a Lens and calculates grid line spacing in adaptive mode.
  • Constructor Details

    • GridMetrics

      public GridMetrics(LX lx, UITimeline timeline)
  • Method Details

    • getSpacing

      public GridMetrics.Spacing getSpacing()
    • getGridSpacing

      public Cursor.Immutable getGridSpacing()
    • onGridChanged

      public void onGridChanged(LXClipEngine.Grid grid)
      Specified by:
      onGridChanged in interface LXClipEngine.Grid.Listener
    • onLensChanged

      public void onLensChanged(Lens lens, boolean sizeChanged, boolean scrollChanged)
      Description copied from interface: Lens.Listener
      Called when the lens positioning is changed
      Specified by:
      onLensChanged in interface Lens.Listener
      Parameters:
      lens - Lens
      sizeChanged - True if total width of the lens has changed
      scrollChanged - True if scroll position of the lens has changed
    • onClipChanged

      public void onClipChanged(Lens lens, LXClip clip)
      Description copied from interface: Lens.Listener
      Called when the clip the Lens is referencing is changed
      Specified by:
      onClipChanged in interface Lens.Listener
      Parameters:
      lens - Lens
      clip - Clip referenced (may be null)
    • update

      protected void update()
    • snap

      public Cursor snap(Cursor cursor, LXClip clip)
      Apply grid snapping to a value. Rounds the value to the nearest multiple of [grid snap size] in time units. Result is not constrained, allowing relative calculations.
      Parameters:
      cursor - Value to snap
      clip - Clip context
      Returns:
      modified value
    • snapUp

      public Cursor snapUp(Cursor cursor, LXClip clip)
      Snaps the cursor up to the next increment of the snap size
      Parameters:
      cursor - Cursor to snap
      clip - Clip context
      Returns:
      Same cursor with snapping applied
    • snapDown

      public Cursor snapDown(Cursor cursor, LXClip clip)
      Snaps the cursor down to the previous increment of the snap size
      Parameters:
      cursor - Cursor to snap
      clip - Clip context
      Returns:
      Same cursor with snapping applied