Class Lens

java.lang.Object
heronarts.lx.studio.ui.timeline.Lens

public class Lens extends Object
Maintains a set of interconnected variables relating to timeline length and a view window into the timeline. Handles all units conversions related to the timeline.
  • Constructor Details

    • Lens

      public Lens(LX lx)
  • Method Details

    • clear

      public void clear()
      Reset all values to default except for viewPixels.
    • setZoom

      public void setZoom(float zoom, Cursor cursor, double viewBasis)
      Set the zoom level, keeping a timeline position (normalized) aligned with an X position (pixels) in the view. This centers the zoom location on the mouse cursor.
      Parameters:
      zoom - New zoom level, normalized. Cannot be zero.
      cursor - Timeline position to keep visible.
      viewBasis - Normalized X within the view (left = 0, right = 1) to place the targeted timeline position.
    • setViewPositionPixels

      public void setViewPositionPixels(float viewPositionPixels)
    • setViewWidthPixels

      public void setViewWidthPixels(float viewWidthPixels)
    • scrollNormalized

      public void scrollNormalized(float normalized)
      Perform a horizontal scroll action on the view by a normalized amount
    • getZoom

      public float getZoom()
    • getZoomMax

      public float getZoomMax()
    • getTotalWidthPixels

      public float getTotalWidthPixels()
    • getViewPositionNormalized

      public float getViewPositionNormalized()
    • getViewPositionPixels

      public float getViewPositionPixels()
    • getViewWidthPixels

      public float getViewWidthPixels()
    • getViewEndPixels

      public float getViewEndPixels()
    • toPixelsFromEvent

      public float toPixelsFromEvent(LXClipEvent<?> event)
    • toPixelsFromCursor

      public float toPixelsFromCursor(Cursor cursor)
    • toPixelsInViewFromCursor

      public float toPixelsInViewFromCursor(Cursor cursor)
    • toViewBasisFromPixels

      public double toViewBasisFromPixels(float pixels)
      Convert absolute pixels to a normalized basis position in the lens view
      Parameters:
      pixels - Absolute lens pixel position
      Returns:
      Normalized basis 0-1 in the visible view
    • toCursorFromViewPosition

      public Cursor toCursorFromViewPosition()
    • toCursorFromPixels

      public Cursor toCursorFromPixels(float pixels)
    • addListener

      public Lens addListener(Lens.Listener listener)
    • addListener

      public Lens addListener(Lens.Listener listener, boolean fireImmediately)
    • removeListener

      public Lens removeListener(Lens.Listener listener)
    • CursorOp

      public Cursor.Operator CursorOp()
    • setClip

      public Lens setClip(LXClip clip)
    • getClip

      public LXClip getClip()