Package heronarts.lx.studio.ui.timeline
Class GridMetrics
java.lang.Object
heronarts.lx.studio.ui.timeline.GridMetrics
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe spacing values are read by the UI thread to draw grid backgrounds and labels, but they are written by the main LX thread when GridMetrics responds to relevant parameter changes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonClipChanged(Lens lens, LXClip clip) Called when the clip the Lens is referencing is changedvoidvoidonLensChanged(Lens lens, boolean sizeChanged, boolean scrollChanged) Called when the lens positioning is changedApply grid snapping to a value.Snaps the cursor down to the previous increment of the snap sizeSnaps the cursor up to the next increment of the snap sizeprotected voidupdate()
-
Constructor Details
-
GridMetrics
-
-
Method Details
-
getSpacing
-
getGridSpacing
-
onGridChanged
- Specified by:
onGridChangedin interfaceLXClipEngine.Grid.Listener
-
onLensChanged
Description copied from interface:Lens.ListenerCalled when the lens positioning is changed- Specified by:
onLensChangedin interfaceLens.Listener- Parameters:
lens- LenssizeChanged- True if total width of the lens has changedscrollChanged- True if scroll position of the lens has changed
-
onClipChanged
Description copied from interface:Lens.ListenerCalled when the clip the Lens is referencing is changed- Specified by:
onClipChangedin interfaceLens.Listener- Parameters:
lens- Lensclip- Clip referenced (may be null)
-
update
protected void update() -
snap
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 snapclip- Clip context- Returns:
- modified value
-
snapUp
Snaps the cursor up to the next increment of the snap size- Parameters:
cursor- Cursor to snapclip- Clip context- Returns:
- Same cursor with snapping applied
-
snapDown
Snaps the cursor down to the previous increment of the snap size- Parameters:
cursor- Cursor to snapclip- Clip context- Returns:
- Same cursor with snapping applied
-