Chromium Code Reviews| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 _animateWindowTimes: function(startTime, endTime) | 536 _animateWindowTimes: function(startTime, endTime) |
| 537 { | 537 { |
| 538 this._timeWindowLeft = startTime; | 538 this._timeWindowLeft = startTime; |
| 539 this._timeWindowRight = endTime; | 539 this._timeWindowRight = endTime; |
| 540 this.update(); | 540 this.update(); |
| 541 }, | 541 }, |
| 542 | 542 |
| 543 _animationCompleted: function() | 543 _animationCompleted: function() |
| 544 { | 544 { |
| 545 delete this._cancelWindowTimesAnimation; | 545 delete this._cancelWindowTimesAnimation; |
| 546 this._highlightEntry(true); | |
| 546 }, | 547 }, |
| 547 | 548 |
| 548 /** | 549 /** |
| 549 * @param {!MouseEvent} event | 550 * @param {!MouseEvent} event |
| 550 */ | 551 */ |
| 551 _initMaxDragOffset: function(event) | 552 _initMaxDragOffset: function(event) |
| 552 { | 553 { |
| 553 this._maxDragOffsetSquared = 0; | 554 this._maxDragOffsetSquared = 0; |
| 554 this._dragStartX = event.pageX; | 555 this._dragStartX = event.pageX; |
| 555 this._dragStartY = event.pageY; | 556 this._dragStartY = event.pageY; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 585 if (!this._timelineData() || this._timeWindowRight === Infinity) | 586 if (!this._timelineData() || this._timeWindowRight === Infinity) |
| 586 return false; | 587 return false; |
| 587 this._isDragging = true; | 588 this._isDragging = true; |
| 588 this._initMaxDragOffset(event); | 589 this._initMaxDragOffset(event); |
| 589 this._dragStartPointX = event.pageX; | 590 this._dragStartPointX = event.pageX; |
| 590 this._dragStartPointY = event.pageY; | 591 this._dragStartPointY = event.pageY; |
| 591 this._dragStartScrollTop = this._vScrollElement.scrollTop; | 592 this._dragStartScrollTop = this._vScrollElement.scrollTop; |
| 592 this._dragStartWindowLeft = this._timeWindowLeft; | 593 this._dragStartWindowLeft = this._timeWindowLeft; |
| 593 this._dragStartWindowRight = this._timeWindowRight; | 594 this._dragStartWindowRight = this._timeWindowRight; |
| 594 this._canvas.style.cursor = ""; | 595 this._canvas.style.cursor = ""; |
| 596 this._highlightEntry(false); | |
| 595 return true; | 597 return true; |
| 596 }, | 598 }, |
| 597 | 599 |
| 598 /** | 600 /** |
| 599 * @param {!MouseEvent} event | 601 * @param {!MouseEvent} event |
| 600 */ | 602 */ |
| 601 _canvasDragging: function(event) | 603 _canvasDragging: function(event) |
| 602 { | 604 { |
| 603 var pixelShift = this._dragStartPointX - event.pageX; | 605 var pixelShift = this._dragStartPointX - event.pageX; |
| 604 this._dragStartPointX = event.pageX; | 606 this._dragStartPointX = event.pageX; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 627 this._isDragging = true; | 629 this._isDragging = true; |
| 628 this._initMaxDragOffset(event); | 630 this._initMaxDragOffset(event); |
| 629 this._selectionOffsetShiftX = event.offsetX - event.pageX; | 631 this._selectionOffsetShiftX = event.offsetX - event.pageX; |
| 630 this._selectionOffsetShiftY = event.offsetY - event.pageY; | 632 this._selectionOffsetShiftY = event.offsetY - event.pageY; |
| 631 this._selectionStartX = event.offsetX; | 633 this._selectionStartX = event.offsetX; |
| 632 var style = this._selectionOverlay.style; | 634 var style = this._selectionOverlay.style; |
| 633 style.left = this._selectionStartX + "px"; | 635 style.left = this._selectionStartX + "px"; |
| 634 style.width = "1px"; | 636 style.width = "1px"; |
| 635 this._selectedTimeSpanLabel.textContent = ""; | 637 this._selectedTimeSpanLabel.textContent = ""; |
| 636 this._selectionOverlay.classList.remove("hidden"); | 638 this._selectionOverlay.classList.remove("hidden"); |
| 639 this._highlightEntry(false); | |
| 637 return true; | 640 return true; |
| 638 }, | 641 }, |
| 639 | 642 |
| 640 _endRangeSelection: function() | 643 _endRangeSelection: function() |
| 641 { | 644 { |
| 642 this._isDragging = false; | 645 this._isDragging = false; |
| 643 this._flameChartDelegate.endRangeSelection(); | 646 this._flameChartDelegate.endRangeSelection(); |
| 644 }, | 647 }, |
| 645 | 648 |
| 646 _hideRangeSelection: function() | 649 _hideRangeSelection: function() |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 674 var timeSpan = this._rangeSelectionEnd - this._rangeSelectionStart; | 677 var timeSpan = this._rangeSelectionEnd - this._rangeSelectionStart; |
| 675 this._selectedTimeSpanLabel.textContent = Number.preciseMillisToString(t imeSpan, 2); | 678 this._selectedTimeSpanLabel.textContent = Number.preciseMillisToString(t imeSpan, 2); |
| 676 }, | 679 }, |
| 677 | 680 |
| 678 /** | 681 /** |
| 679 * @param {!Event} event | 682 * @param {!Event} event |
| 680 */ | 683 */ |
| 681 _onMouseMove: function(event) | 684 _onMouseMove: function(event) |
| 682 { | 685 { |
| 683 this._lastMouseOffsetX = event.offsetX; | 686 this._lastMouseOffsetX = event.offsetX; |
| 687 this._lastMouseOffsetY = event.offsetY; | |
| 684 | 688 |
| 685 if (!this._enabled()) | 689 if (!this._enabled()) |
| 686 return; | 690 return; |
| 687 | 691 |
| 688 if (this._isDragging) | 692 if (this._isDragging) |
| 689 return; | 693 return; |
| 690 | 694 |
| 691 var inDividersBar = event.offsetY < WebInspector.FlameChart.DividersBarH eight; | 695 var inDividersBar = event.offsetY < WebInspector.FlameChart.DividersBarH eight; |
| 692 this._highlightedMarkerIndex = inDividersBar ? this._markerIndexAtPositi on(event.offsetX) : -1; | 696 this._highlightedMarkerIndex = inDividersBar ? this._markerIndexAtPositi on(event.offsetX) : -1; |
| 693 this._updateMarkerHighlight(); | 697 this._updateMarkerHighlight(); |
| 694 this._entryInfo.style.left = event.offsetX + "px"; | 698 this._highlightEntry(true); |
| 695 this._entryInfo.style.top = event.offsetY + "px"; | |
| 696 | |
| 697 this._highlightEntry(this._coordinatesToEntryIndex(event.offsetX, event. offsetY)); | |
| 698 }, | 699 }, |
| 699 | 700 |
| 700 _onMouseOut: function() | 701 _onMouseOut: function() |
| 701 { | 702 { |
| 702 this._highlightEntry(-1); | 703 this._highlightEntry(false); |
| 703 }, | 704 }, |
| 704 | 705 |
| 705 /** | 706 /** |
| 706 * @param {number} entryIndex | 707 * @param {boolean} show |
| 707 */ | 708 */ |
| 708 _highlightEntry: function(entryIndex) | 709 _highlightEntry: function(show) |
|
caseq
2015/11/24 00:40:55
let's just split this into _hideHighlight() and _s
alph
2015/11/24 02:44:56
Done.
| |
| 709 { | 710 { |
| 711 var entryIndex = show ? this._coordinatesToEntryIndex(this._lastMouseOff setX, this._lastMouseOffsetY) : -1; | |
| 712 this._entryInfo.style.left = this._lastMouseOffsetX + "px"; | |
| 713 this._entryInfo.style.top = this._lastMouseOffsetY + "px"; | |
| 710 if (this._highlightedEntryIndex === entryIndex) | 714 if (this._highlightedEntryIndex === entryIndex) |
| 711 return; | 715 return; |
| 712 | 716 |
| 713 if (entryIndex === -1 || !this._dataProvider.canJumpToEntry(entryIndex)) | 717 if (entryIndex === -1 || !this._dataProvider.canJumpToEntry(entryIndex)) |
| 714 this._canvas.style.cursor = "default"; | 718 this._canvas.style.cursor = "default"; |
| 715 else | 719 else |
| 716 this._canvas.style.cursor = "pointer"; | 720 this._canvas.style.cursor = "pointer"; |
| 717 | 721 |
| 718 this._highlightedEntryIndex = entryIndex; | 722 this._highlightedEntryIndex = entryIndex; |
| 719 | 723 |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1506 | 1510 |
| 1507 _updateContentElementSize: function() | 1511 _updateContentElementSize: function() |
| 1508 { | 1512 { |
| 1509 this._offsetWidth = this.contentElement.offsetWidth; | 1513 this._offsetWidth = this.contentElement.offsetWidth; |
| 1510 this._offsetHeight = this.contentElement.offsetHeight; | 1514 this._offsetHeight = this.contentElement.offsetHeight; |
| 1511 }, | 1515 }, |
| 1512 | 1516 |
| 1513 _onScroll: function() | 1517 _onScroll: function() |
| 1514 { | 1518 { |
| 1515 this._scrollTop = this._vScrollElement.scrollTop; | 1519 this._scrollTop = this._vScrollElement.scrollTop; |
| 1520 this._highlightEntry(true); | |
| 1516 this.scheduleUpdate(); | 1521 this.scheduleUpdate(); |
| 1517 }, | 1522 }, |
| 1518 | 1523 |
| 1519 scheduleUpdate: function() | 1524 scheduleUpdate: function() |
| 1520 { | 1525 { |
| 1521 if (this._updateTimerId || this._cancelWindowTimesAnimation) | 1526 if (this._updateTimerId || this._cancelWindowTimesAnimation) |
| 1522 return; | 1527 return; |
| 1523 this._updateTimerId = this.element.window().requestAnimationFrame(this.u pdate.bind(this)); | 1528 this._updateTimerId = this.element.window().requestAnimationFrame(this.u pdate.bind(this)); |
| 1524 }, | 1529 }, |
| 1525 | 1530 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1544 this.update(); | 1549 this.update(); |
| 1545 }, | 1550 }, |
| 1546 | 1551 |
| 1547 _enabled: function() | 1552 _enabled: function() |
| 1548 { | 1553 { |
| 1549 return this._rawTimelineDataLength !== 0; | 1554 return this._rawTimelineDataLength !== 0; |
| 1550 }, | 1555 }, |
| 1551 | 1556 |
| 1552 __proto__: WebInspector.HBox.prototype | 1557 __proto__: WebInspector.HBox.prototype |
| 1553 } | 1558 } |
| OLD | NEW |