OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 _drawFlowEvents(context, width, height) { | 950 _drawFlowEvents(context, width, height) { |
951 context.save(); | 951 context.save(); |
952 var ratio = window.devicePixelRatio; | 952 var ratio = window.devicePixelRatio; |
953 var top = this.getScrollOffset(); | 953 var top = this.getScrollOffset(); |
954 var arrowWidth = 6; | 954 var arrowWidth = 6; |
955 context.scale(ratio, ratio); | 955 context.scale(ratio, ratio); |
956 context.translate(0, -top); | 956 context.translate(0, -top); |
957 | 957 |
958 context.fillStyle = '#7f5050'; | 958 context.fillStyle = '#7f5050'; |
959 context.strokeStyle = '#7f5050'; | 959 context.strokeStyle = '#7f5050'; |
| 960 var td = this._timelineData(); |
| 961 var endIndex = td.flowStartTimes.lowerBound(this._timeWindowRight); |
| 962 |
960 context.lineWidth = 0.5; | 963 context.lineWidth = 0.5; |
961 | 964 for (var i = 0; i < endIndex; ++i) { |
962 var td = this._timelineData(); | |
963 for (var i = 0; i < td.flowStartTimes.length && td.flowStartTimes[i] < this.
_timeWindowRight; ++i) { | |
964 if (!td.flowEndTimes[i] || td.flowEndTimes[i] < this._timeWindowLeft) | 965 if (!td.flowEndTimes[i] || td.flowEndTimes[i] < this._timeWindowLeft) |
965 continue; | 966 continue; |
966 var startX = this._timeToPosition(td.flowStartTimes[i]); | 967 var startX = this._timeToPosition(td.flowStartTimes[i]); |
967 var endX = this._timeToPosition(td.flowEndTimes[i]); | 968 var endX = this._timeToPosition(td.flowEndTimes[i]); |
968 var startY = this._levelToHeight(td.flowStartLevels[i]) + this._barHeight
/ 2; | 969 var startY = this._levelToHeight(td.flowStartLevels[i]) + this._barHeight
/ 2; |
969 var endY = this._levelToHeight(td.flowEndLevels[i]) + this._barHeight / 2; | 970 var endY = this._levelToHeight(td.flowEndLevels[i]) + this._barHeight / 2; |
970 | 971 |
| 972 |
971 var segment = Math.min((endX - startX) / 4, 40); | 973 var segment = Math.min((endX - startX) / 4, 40); |
972 var distanceTime = td.flowEndTimes[i] - td.flowStartTimes[i]; | 974 var distanceTime = td.flowEndTimes[i] - td.flowStartTimes[i]; |
973 var distanceY = (endY - startY) / 10; | 975 var distanceY = (endY - startY) / 10; |
974 var spread = 30; | 976 var spread = 30; |
975 var lineY = distanceTime < 1 ? startY : spread + Math.max(0, startY + dist
anceY * (i % spread)); | 977 var lineY = distanceTime < 1 ? startY : spread + Math.max(0, startY + dist
anceY * (i % spread)); |
976 | 978 |
977 var p = []; | 979 var p = []; |
978 p.push({x: startX, y: startY}); | 980 p.push({x: startX, y: startY}); |
979 p.push({x: startX + arrowWidth, y: startY}); | 981 p.push({x: startX + arrowWidth, y: startY}); |
980 p.push({x: startX + segment + 2 * arrowWidth, y: startY}); | 982 p.push({x: startX + segment + 2 * arrowWidth, y: startY}); |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 } | 1601 } |
1600 | 1602 |
1601 /** | 1603 /** |
1602 * @override | 1604 * @override |
1603 * @return {number} | 1605 * @return {number} |
1604 */ | 1606 */ |
1605 boundarySpan() { | 1607 boundarySpan() { |
1606 return this._maximumBoundaries - this._minimumBoundaries; | 1608 return this._maximumBoundaries - this._minimumBoundaries; |
1607 } | 1609 } |
1608 }; | 1610 }; |
OLD | NEW |