Permalink
Browse files

Small change to make the timeline stay under a certain width if desir…

…ed, no clipping is done yet so this maxWidth is still not respected fully.
  • Loading branch information...
andreasmuller committed Apr 11, 2012
1 parent d66ee77 commit 482febc9dd050ad8e61e5076feda319eafde76ae
Showing with 17 additions and 2 deletions.
  1. +14 −2 src/ofxTimeline.cpp
  2. +3 −0 src/ofxTimeline.h
View
@@ -62,7 +62,8 @@ ofxTimeline::ofxTimeline()
movePlayheadOnPaste(true),
movePlayheadOnDrag(true),
inoutRange(ofRange(0.0,1.0)),
- currentPage(NULL)
+ currentPage(NULL),
+ maxWidth(-1.0f)
{
}
@@ -88,7 +89,13 @@ void ofxTimeline::setup(){
isSetup = true;
width = ofGetWidth();
-
+
+ // Sometimes we want the width to stay within a certain value,
+ // like when we have a multiscreen canvas, needs to be set before calling setup
+ if( maxWidth > 0.0f ){
+ width = ofClamp( width, 0.0f, maxWidth );
+ }
+
tabs = new ofxTLPageTabs();
tabs->setTimeline(this);
tabs->setup();
@@ -430,6 +437,11 @@ void ofxTimeline::setSnapping(bool snapping){
}
}
+void ofxTimeline::setMaxWidth( float _maxW )
+{
+ maxWidth = _maxW;
+}
+
void ofxTimeline::unselectAll(){
currentPage->unselectAll();
}
View
@@ -122,6 +122,8 @@ class ofxTimeline {
virtual void setSnapping(bool snapping);
virtual void toggleSnapping();
+ void setMaxWidth( float _w );
+
//setting a BPM allows for a global measure across the timeline
//this is useful for snapping to intervals
virtual void enableSnapToBPM(float bpm); //beats per minute
@@ -232,6 +234,7 @@ class ofxTimeline {
ofxTLZoomer* zoomer;
float width;
+ float maxWidth;
ofVec2f offset;
virtual void enableEvents();

0 comments on commit 482febc

Please sign in to comment.