Package heronarts.lx.studio.ui.timeline
Class Lens
java.lang.Object
heronarts.lx.studio.ui.timeline.Lens
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddListener(Lens.Listener listener) addListener(Lens.Listener listener, boolean fireImmediately) voidclear()Reset all values to default except for viewPixels.CursorOp()getClip()floatfloatfloatfloatfloatfloatgetZoom()floatremoveListener(Lens.Listener listener) voidscrollNormalized(float normalized) Perform a horizontal scroll action on the view by a normalized amountvoidsetViewPositionPixels(float viewPositionPixels) voidsetViewWidthPixels(float viewWidthPixels) voidSet the zoom level, keeping a timeline position (normalized) aligned with an X position (pixels) in the view.toCursorFromPixels(float pixels) floattoPixelsFromCursor(Cursor cursor) floattoPixelsFromEvent(LXClipEvent<?> event) floattoPixelsInViewFromCursor(Cursor cursor) doubletoViewBasisFromPixels(float pixels) Convert absolute pixels to a normalized basis position in the lens view
-
Constructor Details
-
Lens
-
-
Method Details
-
clear
public void clear()Reset all values to default except for viewPixels. -
setZoom
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
-
toPixelsFromCursor
-
toPixelsInViewFromCursor
-
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
-
toCursorFromPixels
-
addListener
-
addListener
-
removeListener
-
CursorOp
-
setClip
-
getClip
-