32 App.directive(
'tlTrack',
function($timeout) {
36 link:
function(scope, element, attrs) {
38 scope.$watch(
'project.layers.length',
function (val) {
42 scope.UpdateLayerIndex();
43 scope.playhead_height = $(
"#track-container").
height();
44 $(
".playhead-line").
height(scope.playhead_height);
53 drop:
function(event,ui) {
56 scope.enable_sorting =
false;
58 var vert_scroll_offset = $(
"#scrolling_tracks").
scrollTop();
59 var horz_scroll_offset = $(
"#scrolling_tracks").scrollLeft();
62 var scrolling_tracks_offset_left = $(
"#scrolling_tracks").
offset().left;
63 var scrolling_tracks_offset_top = $(
"#scrolling_tracks").
offset().top;
66 var dropped_clips = [];
67 var position_diff = 0;
72 $(
".ui-selected").
each(
function() {
76 if ($(
".ui-selected").length > 1)
78 for (var clip_index = 0; clip_index < scope.project.clips.length; clip_index++) {
79 scope.project.clips[clip_index].selected =
false;
81 timeline.removeSelection(scope.project.clips[clip_index].id.replace(
"clip_",
""),
"clip");
83 for (var tran_index = 0; tran_index < scope.project.effects.length; tran_index++) {
84 scope.project.effects[tran_index].selected =
false;
86 timeline.removeSelection(scope.project.effects[tran_index].id.replace(
"transition_",
""),
"transition");
92 if (item.hasClass(
'clip'))
94 else if(item.hasClass(
'transition'))
95 item_type =
'transition';
101 item_id = item.attr(
"id");
102 item_num = item_id.substr(item_id.indexOf(
"_") + 1);
103 item_middle = item.position().top + (item.height() / 2);
104 item_left = item.position().left;
107 item_left = parseFloat(item_left + horz_scroll_offset);
108 item_middle = parseFloat(item_middle - scrolling_tracks_offset_top + vert_scroll_offset);
111 if (item_left < 0) item_left = 0;
117 if (drop_track_num != -1){
121 if (item_type ==
'clip')
122 item_data =
findElement(scope.project.clips,
"id", item_num);
123 else if (item_type ==
'transition')
124 item_data =
findElement(scope.project.effects,
"id", item_num);
127 if (position_diff == 0.0)
129 position_diff = (item_left / scope.pixelsPerSecond) - item_data.position;
132 scope.$apply(
function(){
134 item_data.layer = drop_track_num;
135 item_data.position += position_diff;
139 scope.ResizeTimeline();
142 dropped_clips.push(item_data);
145 if (scope.Qt && item_type ==
'clip')
146 timeline.update_clip_data(JSON.stringify(item_data));
148 else if (scope.Qt && item_type ==
'transition')
149 timeline.update_transition_data(JSON.stringify(item_data));
156 if (dropped_clips.length == 1)
158 for (var clip_index = 0; clip_index < dropped_clips.length; clip_index++) {
159 var item_data = dropped_clips[clip_index];
162 missing_transition_details = scope.GetMissingTransitions(item_data);
163 if (scope.Qt && missing_transition_details != null)
164 timeline.add_missing_transition(JSON.stringify(missing_transition_details));
171 scope.enable_sorting =
true;
function findElement(arr, propName, propValue)
Tween propHooks scrollTop
jQuery each(["height","width"], function(i, name){jQuery.cssHooks[name]={get:function(elem, computed, extra){if(computed){return elem.offsetWidth===0 &&rdisplayswap.test(jQuery.css(elem,"display"))?jQuery.swap(elem, cssShow, function(){return getWidthOrHeight(elem, name, extra);}):getWidthOrHeight(elem, name, extra);}}, set:function(elem, value, extra){var styles=extra &&getStyles(elem);return setPositiveNumber(elem, value, extra?augmentWidthOrHeight(elem, name, extra, jQuery.support.boxSizing &&jQuery.css(elem,"boxSizing", false, styles)==="border-box", styles):0);}};})
function findTrackAtLocation(scope, top)