| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 WebInspector.installDragHandle(this._canvas, this._startCanvasDragging.bind(
this), this._canvasDragging.bind(this), this._endCanvasDragging.bind(this), "mov
e", null); | 68 WebInspector.installDragHandle(this._canvas, this._startCanvasDragging.bind(
this), this._canvasDragging.bind(this), this._endCanvasDragging.bind(this), "mov
e", null); |
| 69 | 69 |
| 70 this._vScrollElement = this.element.createChild("div", "flame-chart-v-scroll
"); | 70 this._vScrollElement = this.element.createChild("div", "flame-chart-v-scroll
"); |
| 71 this._vScrollContent = this._vScrollElement.createChild("div"); | 71 this._vScrollContent = this._vScrollElement.createChild("div"); |
| 72 this._vScrollElement.addEventListener("scroll", this.scheduleUpdate.bind(thi
s), false); | 72 this._vScrollElement.addEventListener("scroll", this.scheduleUpdate.bind(thi
s), false); |
| 73 | 73 |
| 74 this._entryInfo = this.element.createChild("div", "profile-entry-info"); | 74 this._entryInfo = this.element.createChild("div", "profile-entry-info"); |
| 75 this._markerHighlighElement = this.element.createChild("div", "flame-chart-m
arker-highlight-element"); | 75 this._markerHighlighElement = this.element.createChild("div", "flame-chart-m
arker-highlight-element"); |
| 76 this._highlightElement = this.element.createChild("div", "flame-chart-highli
ght-element"); | 76 this._highlightElement = this.element.createChild("div", "flame-chart-highli
ght-element"); |
| 77 this._selectedElement = this.element.createChild("div", "flame-chart-selecte
d-element"); | 77 this._selectedElement = this.element.createChild("div", "flame-chart-selecte
d-element"); |
| 78 this._selectionOverlay = this.element.createChild("div", "flame-chart-select
ion-overlay hidden"); |
| 79 this._selectedTimeSpanLabel = this._selectionOverlay.createChild("div", "tim
e-span"); |
| 78 | 80 |
| 79 this._dataProvider = dataProvider; | 81 this._dataProvider = dataProvider; |
| 80 | 82 |
| 81 this._windowLeft = 0.0; | 83 this._windowLeft = 0.0; |
| 82 this._windowRight = 1.0; | 84 this._windowRight = 1.0; |
| 83 this._windowWidth = 1.0; | 85 this._windowWidth = 1.0; |
| 84 this._timeWindowLeft = 0; | 86 this._timeWindowLeft = 0; |
| 85 this._timeWindowRight = Infinity; | 87 this._timeWindowRight = Infinity; |
| 86 this._barHeight = dataProvider.barHeight(); | 88 this._barHeight = dataProvider.barHeight(); |
| 87 this._barHeightDelta = this._isTopDown ? -this._barHeight : this._barHeight; | 89 this._barHeightDelta = this._isTopDown ? -this._barHeight : this._barHeight; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 _animationCompleted: function() | 467 _animationCompleted: function() |
| 466 { | 468 { |
| 467 delete this._cancelWindowTimesAnimation; | 469 delete this._cancelWindowTimesAnimation; |
| 468 }, | 470 }, |
| 469 | 471 |
| 470 /** | 472 /** |
| 471 * @param {!MouseEvent} event | 473 * @param {!MouseEvent} event |
| 472 */ | 474 */ |
| 473 _startCanvasDragging: function(event) | 475 _startCanvasDragging: function(event) |
| 474 { | 476 { |
| 477 if (event.shiftKey) { |
| 478 this._startBoxSelection(event); |
| 479 this._isDragging = true; |
| 480 return true; |
| 481 } |
| 475 if (!this._timelineData() || this._timeWindowRight === Infinity) | 482 if (!this._timelineData() || this._timeWindowRight === Infinity) |
| 476 return false; | 483 return false; |
| 477 this._isDragging = true; | 484 this._isDragging = true; |
| 478 this._maxDragOffset = 0; | 485 this._maxDragOffset = 0; |
| 479 this._dragStartPointX = event.pageX; | 486 this._dragStartPointX = event.pageX; |
| 480 this._dragStartPointY = event.pageY; | 487 this._dragStartPointY = event.pageY; |
| 481 this._dragStartScrollTop = this._vScrollElement.scrollTop; | 488 this._dragStartScrollTop = this._vScrollElement.scrollTop; |
| 482 this._dragStartWindowLeft = this._timeWindowLeft; | 489 this._dragStartWindowLeft = this._timeWindowLeft; |
| 483 this._dragStartWindowRight = this._timeWindowRight; | 490 this._dragStartWindowRight = this._timeWindowRight; |
| 484 this._canvas.style.cursor = ""; | 491 this._canvas.style.cursor = ""; |
| 485 | 492 |
| 486 return true; | 493 return true; |
| 487 }, | 494 }, |
| 488 | 495 |
| 489 /** | 496 /** |
| 490 * @param {!MouseEvent} event | 497 * @param {!MouseEvent} event |
| 491 */ | 498 */ |
| 492 _canvasDragging: function(event) | 499 _canvasDragging: function(event) |
| 493 { | 500 { |
| 501 if (this._isSelecting) { |
| 502 this._updateBoxSelection(event); |
| 503 return; |
| 504 } |
| 494 var pixelShift = this._dragStartPointX - event.pageX; | 505 var pixelShift = this._dragStartPointX - event.pageX; |
| 495 this._dragStartPointX = event.pageX; | 506 this._dragStartPointX = event.pageX; |
| 496 this._muteAnimation = true; | 507 this._muteAnimation = true; |
| 497 this._handlePanGesture(pixelShift * this._pixelToTime); | 508 this._handlePanGesture(pixelShift * this._pixelToTime); |
| 498 this._muteAnimation = false; | 509 this._muteAnimation = false; |
| 499 | 510 |
| 500 var pixelScroll = this._dragStartPointY - event.pageY; | 511 var pixelScroll = this._dragStartPointY - event.pageY; |
| 501 this._vScrollElement.scrollTop = this._dragStartScrollTop + pixelScroll; | 512 this._vScrollElement.scrollTop = this._dragStartScrollTop + pixelScroll; |
| 502 this._maxDragOffset = Math.max(this._maxDragOffset, Math.abs(pixelShift)
); | 513 this._maxDragOffset = Math.max(this._maxDragOffset, Math.abs(pixelShift)
); |
| 503 }, | 514 }, |
| 504 | 515 |
| 505 _endCanvasDragging: function() | 516 _endCanvasDragging: function() |
| 506 { | 517 { |
| 518 this._hideBoxSelection(); |
| 507 this._isDragging = false; | 519 this._isDragging = false; |
| 508 }, | 520 }, |
| 509 | 521 |
| 510 /** | 522 /** |
| 523 * @param {!MouseEvent} event |
| 524 */ |
| 525 _startBoxSelection: function(event) |
| 526 { |
| 527 this._selectionOffsetShiftX = event.offsetX - event.pageX; |
| 528 this._selectionOffsetShiftY = event.offsetY - event.pageY; |
| 529 this._selectionStartX = event.offsetX; |
| 530 this._selectionStartY = event.offsetY; |
| 531 this._isSelecting = true; |
| 532 var style = this._selectionOverlay.style; |
| 533 style.left = this._selectionStartX + "px"; |
| 534 style.top = this._selectionStartY + "px"; |
| 535 style.width = "1px"; |
| 536 style.height = "1px"; |
| 537 this._selectedTimeSpanLabel.textContent = ""; |
| 538 this._selectionOverlay.classList.remove("hidden"); |
| 539 }, |
| 540 |
| 541 _hideBoxSelection: function() |
| 542 { |
| 543 this._selectionOffsetShiftX = null; |
| 544 this._selectionOffsetShiftY = null; |
| 545 this._selectionStartX = null; |
| 546 this._selectionStartY = null; |
| 547 this._isSelecting = false; |
| 548 this._selectionOverlay.classList.add("hidden"); |
| 549 }, |
| 550 |
| 551 /** |
| 552 * @param {!MouseEvent} event |
| 553 */ |
| 554 _updateBoxSelection: function(event) |
| 555 { |
| 556 var x = event.pageX + this._selectionOffsetShiftX; |
| 557 var y = event.pageY + this._selectionOffsetShiftY; |
| 558 x = Number.constrain(x, 0, this._offsetWidth); |
| 559 y = Number.constrain(y, 0, this._offsetHeight); |
| 560 var style = this._selectionOverlay.style; |
| 561 style.left = Math.min(x, this._selectionStartX) + "px"; |
| 562 style.top = Math.min(y, this._selectionStartY) + "px"; |
| 563 var selectionWidth = Math.abs(x - this._selectionStartX) |
| 564 style.width = selectionWidth + "px"; |
| 565 style.height = Math.abs(y - this._selectionStartY) + "px"; |
| 566 |
| 567 var timeSpan = selectionWidth * this._pixelToTime; |
| 568 this._selectedTimeSpanLabel.textContent = Number.preciseMillisToString(
timeSpan, 2); |
| 569 }, |
| 570 |
| 571 /** |
| 511 * @param {!Event} event | 572 * @param {!Event} event |
| 512 */ | 573 */ |
| 513 _onMouseMove: function(event) | 574 _onMouseMove: function(event) |
| 514 { | 575 { |
| 515 this._lastMouseOffsetX = event.offsetX; | 576 this._lastMouseOffsetX = event.offsetX; |
| 516 | 577 |
| 517 if (this._isDragging) | 578 if (this._isDragging) |
| 518 return; | 579 return; |
| 519 | 580 |
| 520 var inDividersBar = event.offsetY < WebInspector.FlameChart.DividersBarH
eight; | 581 var inDividersBar = event.offsetY < WebInspector.FlameChart.DividersBarH
eight; |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 { | 1240 { |
| 1180 this._highlightedMarkerIndex = -1; | 1241 this._highlightedMarkerIndex = -1; |
| 1181 this._highlightedEntryIndex = -1; | 1242 this._highlightedEntryIndex = -1; |
| 1182 this._selectedEntryIndex = -1; | 1243 this._selectedEntryIndex = -1; |
| 1183 this._textWidth = {}; | 1244 this._textWidth = {}; |
| 1184 this.update(); | 1245 this.update(); |
| 1185 }, | 1246 }, |
| 1186 | 1247 |
| 1187 __proto__: WebInspector.HBox.prototype | 1248 __proto__: WebInspector.HBox.prototype |
| 1188 } | 1249 } |
| OLD | NEW |