Fixing an issue with transition overlap.
Transitions that are not overlapping no longer stay in the same row. This should fix the problem. Bug: b/200516237 Test: run a trace with pip enter, then rotation. Tags should display in the same row on timeline. Change-Id: I39b50f7636ec7c02de5e15e117542dface0154fc
This commit is contained in:
@@ -173,21 +173,26 @@ export default {
|
||||
|
||||
//compare each transition to the ones that came before
|
||||
for (let curr=0; curr<transitions.length; curr++) {
|
||||
let overlapStore = [];
|
||||
let processedTransitions = [];
|
||||
|
||||
for (let prev=0; prev<curr; prev++) {
|
||||
overlapStore.push(transitions[prev].overlap);
|
||||
processedTransitions.push(transitions[prev]);
|
||||
|
||||
if (transitions[prev].startPos <= transitions[curr].startPos
|
||||
&& transitions[curr].startPos <= transitions[prev].startPos+transitions[prev].width
|
||||
&& transitions[curr].overlap === transitions[prev].overlap) {
|
||||
if (this.isSimultaneousTransition(transitions[curr], transitions[prev])) {
|
||||
transitions[curr].overlap++;
|
||||
}
|
||||
}
|
||||
|
||||
if (overlapStore.length>0
|
||||
&& transitions[curr].overlap === Math.max(overlapStore)
|
||||
) transitions[curr].overlap++;
|
||||
let overlapStore = processedTransitions.map(transition => transition.overlap);
|
||||
|
||||
if (transitions[curr].overlap === Math.max(...overlapStore)) {
|
||||
let previousTransition = processedTransitions.find(transition => {
|
||||
return transition.overlap===transitions[curr].overlap;
|
||||
});
|
||||
if (this.isSimultaneousTransition(transitions[curr], previousTransition)) {
|
||||
transitions[curr].overlap++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Object.freeze(transitions);
|
||||
@@ -247,6 +252,12 @@ export default {
|
||||
return this.position(endTs) - this.position(startTs) + this.pointWidth;
|
||||
},
|
||||
|
||||
isSimultaneousTransition(currTransition, prevTransition) {
|
||||
return prevTransition.startPos <= currTransition.startPos
|
||||
&& currTransition.startPos <= prevTransition.startPos+prevTransition.width
|
||||
&& currTransition.overlap === prevTransition.overlap;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a position as a percentage of the timeline width to a timestamp.
|
||||
* @param {number} position - target position as a percentage of the
|
||||
|
||||
Reference in New Issue
Block a user