Browse Source

Added stability to initial animation of bottom timeline

pull/197/head
Zach Wise 13 years ago
parent
commit
92d5094ff8
  1. 25
      source/js/VMM.Timeline.TimeNav.js

25
source/js/VMM.Timeline.TimeNav.js

@ -289,7 +289,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
scroll_to = config.nav.constraint.right; scroll_to = config.nav.constraint.right;
} }
VMM.Lib.stop($timenav); //VMM.Lib.stop($timenav);
//VMM.Lib.animate($timenav, config.duration/2, "linear", {"left": scroll_to}); //VMM.Lib.animate($timenav, config.duration/2, "linear", {"left": scroll_to});
VMM.Lib.css($timenav, "left", scroll_to); VMM.Lib.css($timenav, "left", scroll_to);
} }
@ -318,6 +318,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}; };
var goToMarker = function(n, ease, duration, fast, firstrun) { var goToMarker = function(n, ease, duration, fast, firstrun) {
trace("GO TO MARKER");
var _ease = config.ease, var _ease = config.ease,
_duration = config.duration, _duration = config.duration,
is_last = false, is_last = false,
@ -325,7 +326,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
current_marker = n; current_marker = n;
timenav_pos.left = (config.width/2) - VMM.Lib.position(markers[current_marker].marker).left; timenav_pos.left = (config.width/2) - markers[current_marker].pos_left
timenav_pos.visible.left = Math.abs(timenav_pos.left) - 100; timenav_pos.visible.left = Math.abs(timenav_pos.left) - 100;
timenav_pos.visible.right = Math.abs(timenav_pos.left) + config.width + 100; timenav_pos.visible.right = Math.abs(timenav_pos.left) + config.width + 100;
@ -730,6 +731,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
pos.begin = Math.round(pos.begin + pos_offset); pos.begin = Math.round(pos.begin + pos_offset);
pos.end = Math.round(pos.end + pos_offset); pos.end = Math.round(pos.end + pos_offset);
line = Math.round(pos.end - pos.begin); line = Math.round(pos.end - pos.begin);
marker.pos_left = pos.begin;
if (current_marker == i) { if (current_marker == i) {
timenav_pos.left = (config.width/2) - pos; timenav_pos.left = (config.width/2) - pos;
@ -837,8 +839,13 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
// ANIMATE THE TIMELINE TO ADJUST TO CHANGES // ANIMATE THE TIMELINE TO ADJUST TO CHANGES
if (is_animated) {
VMM.Lib.stop($timenav); VMM.Lib.stop($timenav);
VMM.Lib.animate($timenav, config.duration/2, config.ease, {"left": (config.width/2) - (cur_mark)}); VMM.Lib.animate($timenav, config.duration/2, config.ease, {"left": (config.width/2) - (cur_mark)});
} else {
}
//VMM.Lib.delay_animate(config.duration, $timenav, config.duration/2, config.ease, {"left": (config.width/2) - (cur_mark)}); //VMM.Lib.delay_animate(config.duration, $timenav, config.duration/2, config.ease, {"left": (config.width/2) - (cur_mark)});
@ -1256,7 +1263,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
buildMarkers(); buildMarkers();
buildEras(); buildEras();
calculateMultiplier(); calculateMultiplier();
positionMarkers(); positionMarkers(false);
positionEras(); positionEras();
positionInterval($timeinterval, interval_array, false, true); positionInterval($timeinterval, interval_array, false, true);
@ -1297,10 +1304,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.bindEvent(layout, onMouseScroll, 'mousewheel'); VMM.bindEvent(layout, onMouseScroll, 'mousewheel');
} }
VMM.fireEvent(layout, "LOADED");
_active = true;
reSize(true);
// USER CONFIGURABLE ADJUSTMENT TO DEFAULT ZOOM // USER CONFIGURABLE ADJUSTMENT TO DEFAULT ZOOM
if (config.nav.zoom.adjust != 0) { if (config.nav.zoom.adjust != 0) {
@ -1315,6 +1319,12 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
} }
//VMM.fireEvent(layout, "LOADED");
_active = true;
reSize(true);
VMM.fireEvent(layout, "LOADED");
}; };
var buildInterval = function() { var buildInterval = function() {
@ -1493,7 +1503,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
type: "marker", type: "marker",
full: true, full: true,
relative_pos: _marker_relative_pos, relative_pos: _marker_relative_pos,
tag: data[i].tag tag: data[i].tag,
pos_left: 0
}; };

Loading…
Cancel
Save