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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 * @return {?WebInspector.FlameChart.TimelineData} | 408 * @return {?WebInspector.FlameChart.TimelineData} |
409 */ | 409 */ |
410 _timelineData: function() | 410 _timelineData: function() |
411 { | 411 { |
412 var timelineData = this._dataProvider.timelineData(); | 412 var timelineData = this._dataProvider.timelineData(); |
413 if (timelineData !== this._rawTimelineData || timelineData.entryStartTim
es.length !== this._rawTimelineDataLength) | 413 if (timelineData !== this._rawTimelineData || timelineData.entryStartTim
es.length !== this._rawTimelineDataLength) |
414 this._processTimelineData(timelineData); | 414 this._processTimelineData(timelineData); |
415 return this._rawTimelineData; | 415 return this._rawTimelineData; |
416 }, | 416 }, |
417 | 417 |
| 418 _cancelAnimation: function() |
| 419 { |
| 420 if (this._cancelWindowTimesAnimation) { |
| 421 this._timeWindowLeft = this._pendingAnimationTimeLeft; |
| 422 this._timeWindowRight = this._pendingAnimationTimeRight; |
| 423 this._cancelWindowTimesAnimation(); |
| 424 delete this._cancelWindowTimesAnimation; |
| 425 } |
| 426 }, |
| 427 |
418 /** | 428 /** |
419 * @param {number} startTime | 429 * @param {number} startTime |
420 * @param {number} endTime | 430 * @param {number} endTime |
421 */ | 431 */ |
422 setWindowTimes: function(startTime, endTime) | 432 setWindowTimes: function(startTime, endTime) |
423 { | 433 { |
424 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindo
wRight === Infinity) { | 434 if (this._muteAnimation || this._timeWindowLeft === 0 || this._timeWindo
wRight === Infinity) { |
425 // Initial setup. | 435 // Initial setup. |
426 this._timeWindowLeft = startTime; | 436 this._timeWindowLeft = startTime; |
427 this._timeWindowRight = endTime; | 437 this._timeWindowRight = endTime; |
428 this.scheduleUpdate(); | 438 this.scheduleUpdate(); |
429 return; | 439 return; |
430 } | 440 } |
431 | 441 |
432 if (this._cancelWindowTimesAnimation) | 442 this._cancelAnimation(); |
433 this._cancelWindowTimesAnimation(); | |
434 this._cancelWindowTimesAnimation = WebInspector.animateFunction(this._an
imateWindowTimes.bind(this), | 443 this._cancelWindowTimesAnimation = WebInspector.animateFunction(this._an
imateWindowTimes.bind(this), |
435 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindo
wRight, to: endTime}], 5, | 444 [{from: this._timeWindowLeft, to: startTime}, {from: this._timeWindo
wRight, to: endTime}], 5, |
436 this._animationCompleted.bind(this)); | 445 this._animationCompleted.bind(this)); |
| 446 this._pendingAnimationTimeLeft = startTime; |
| 447 this._pendingAnimationTimeRight = endTime; |
437 }, | 448 }, |
438 | 449 |
439 /** | 450 /** |
440 * @param {number} startTime | 451 * @param {number} startTime |
441 * @param {number} endTime | 452 * @param {number} endTime |
442 */ | 453 */ |
443 _animateWindowTimes: function(startTime, endTime) | 454 _animateWindowTimes: function(startTime, endTime) |
444 { | 455 { |
445 this._timeWindowLeft = startTime; | 456 this._timeWindowLeft = startTime; |
446 this._timeWindowRight = endTime; | 457 this._timeWindowRight = endTime; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 this._handleZoomGesture(zoomMultiplier); | 603 this._handleZoomGesture(zoomMultiplier); |
593 e.consume(true); | 604 e.consume(true); |
594 } | 605 } |
595 }, | 606 }, |
596 | 607 |
597 /** | 608 /** |
598 * @param {number} zoom | 609 * @param {number} zoom |
599 */ | 610 */ |
600 _handleZoomGesture: function(zoom) | 611 _handleZoomGesture: function(zoom) |
601 { | 612 { |
| 613 this._cancelAnimation(); |
602 var bounds = this._windowForGesture(); | 614 var bounds = this._windowForGesture(); |
603 var cursorTime = this._cursorTime(this._lastMouseOffsetX); | 615 var cursorTime = this._cursorTime(this._lastMouseOffsetX); |
604 bounds.left += (bounds.left - cursorTime) * zoom; | 616 bounds.left += (bounds.left - cursorTime) * zoom; |
605 bounds.right += (bounds.right - cursorTime) * zoom; | 617 bounds.right += (bounds.right - cursorTime) * zoom; |
606 this._requestWindowTimes(bounds); | 618 this._requestWindowTimes(bounds); |
607 }, | 619 }, |
608 | 620 |
609 /** | 621 /** |
610 * @param {number} shift | 622 * @param {number} shift |
611 */ | 623 */ |
612 _handlePanGesture: function(shift) | 624 _handlePanGesture: function(shift) |
613 { | 625 { |
| 626 this._cancelAnimation(); |
614 var bounds = this._windowForGesture(); | 627 var bounds = this._windowForGesture(); |
615 shift = Number.constrain(shift, this._minimumBoundary - bounds.left, thi
s._totalTime + this._minimumBoundary - bounds.right); | 628 shift = Number.constrain(shift, this._minimumBoundary - bounds.left, thi
s._totalTime + this._minimumBoundary - bounds.right); |
616 bounds.left += shift; | 629 bounds.left += shift; |
617 bounds.right += shift; | 630 bounds.right += shift; |
618 this._requestWindowTimes(bounds); | 631 this._requestWindowTimes(bounds); |
619 }, | 632 }, |
620 | 633 |
621 /** | 634 /** |
622 * @return {{left: number, right: number}} | 635 * @return {{left: number, right: number}} |
623 */ | 636 */ |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 { | 1174 { |
1162 this._highlightedMarkerIndex = -1; | 1175 this._highlightedMarkerIndex = -1; |
1163 this._highlightedEntryIndex = -1; | 1176 this._highlightedEntryIndex = -1; |
1164 this._selectedEntryIndex = -1; | 1177 this._selectedEntryIndex = -1; |
1165 this._textWidth = {}; | 1178 this._textWidth = {}; |
1166 this.update(); | 1179 this.update(); |
1167 }, | 1180 }, |
1168 | 1181 |
1169 __proto__: WebInspector.HBox.prototype | 1182 __proto__: WebInspector.HBox.prototype |
1170 } | 1183 } |
OLD | NEW |