Created and Applied TimelineWidget::ZoomSmoothing
This commit is contained in:
parent
6c17d06e66
commit
0aa3ca76d1
5 changed files with 10 additions and 17 deletions
|
|
@ -334,19 +334,9 @@ TimelinePanel::update_tool_buttons()
|
|||
void
|
||||
TimelinePanel::update_zoom_buttons()
|
||||
{
|
||||
REQUIRE(timelineWidget);
|
||||
|
||||
int64_t current_scale =
|
||||
timelineWidget->get_state()->get_view_window().get_time_scale();
|
||||
|
||||
double linear_scale =
|
||||
(double) current_scale / (double) TimelineWidget::MaxScale;
|
||||
|
||||
/* We have to Revese the Smoothing */
|
||||
double new_relative_scale =
|
||||
pow(linear_scale,(1.0/9.0));
|
||||
|
||||
timelineWidget->zoom_view (new_relative_scale);
|
||||
/* This function is no longer needed
|
||||
* TODO: Let the ZoomScaleWidget perform
|
||||
* the update on its own */
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ namespace widgets {
|
|||
const int TimelineWidget::TrackPadding = 1;
|
||||
const int TimelineWidget::HeaderWidth = 150;
|
||||
const int TimelineWidget::HeaderIndentWidth = 10;
|
||||
const double TimelineWidget::ZoomIncrement = 1.25;
|
||||
const double TimelineWidget::ZoomIncrement = 1.25; // Not currently used
|
||||
const double TimelineWidget::ZoomSmoothing = 9.0;
|
||||
const int64_t TimelineWidget::MaxScale = 30000000; // 30 Million
|
||||
|
||||
TimelineWidget::TimelineWidget(shared_ptr<timeline::TimelineState> source_state)
|
||||
|
|
|
|||
|
|
@ -285,6 +285,7 @@ public:
|
|||
* to 30000000 lumiera::Time increments.
|
||||
*/
|
||||
static const int64_t MaxScale;
|
||||
static const double ZoomSmoothing;
|
||||
|
||||
protected:
|
||||
static const int TrackPadding;
|
||||
|
|
|
|||
|
|
@ -88,9 +88,10 @@ TimelineViewWindow::set_time_scale(double ratio)
|
|||
void
|
||||
TimelineViewWindow::zoom_view(int point, double time_scale_ratio)
|
||||
{
|
||||
TODO("Find a Central place for a Zoom Smoothing Factor Variable. Right now it is hard coded at 9.0");
|
||||
// Apply the smoothing factor
|
||||
int64_t new_time_scale =
|
||||
(int64_t)( pow(time_scale_ratio, 9.0) * (double)TimelineWidget::MaxScale);
|
||||
(int64_t)( pow(time_scale_ratio, TimelineWidget::ZoomSmoothing) *
|
||||
(double)TimelineWidget::MaxScale);
|
||||
|
||||
/* Prevent Zooming in To Close and Far */
|
||||
if(new_time_scale < 1)
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ TimelineZoomScale::on_timeline_state_changed (shared_ptr<TimelineState> newState
|
|||
|
||||
/* We have to Revese the Smoothing */
|
||||
double new_relative_scale =
|
||||
pow(linear_scale,(1.0/9.0));
|
||||
pow(linear_scale,(1.0 / TimelineWidget::ZoomSmoothing));
|
||||
|
||||
adjustment.set_value(new_relative_scale);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue