Skip to content

Commit

Permalink
Skip hover highlight/unhighlight when search is on to respect the sea…
Browse files Browse the repository at this point in the history
…rch's highlighting behavior.

PiperOrigin-RevId: 665567631
  • Loading branch information
zzzaries authored and copybara-github committed Aug 20, 2024
1 parent d945fc0 commit a79bc43
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugin/trace_viewer/tf_trace_viewer/tf-trace-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -806,16 +806,27 @@
el.style.visibility = 'hidden';
},

_getSearchText: function() {
const findController = document.querySelector('tr-ui-find-control');
return findController?.$?.filter?.value || '';
},

_unHighlightRect: function() {
if (this._hoverRect === null) return;
// Skip highlight/unhighlight if search is on
if (this._getSearchText().length > 0) {
this._hoverRect = null;
return;
}
this._hoverRect.selectionState = tr.model.SelectionState.NONE;
this._hoverRect = null;
const modelTrackContainer = this._traceViewer.trackView.modelTrackContainer_;
modelTrackContainer.viewport_.dispatchChangeEvent();
},

_highlightRect: function(rect) {
if (rect === null) return;
// Skip highlight/unhighlight if search is on
if (rect === null || this._getSearchText().length > 0) return;
rect.selectionState = tr.model.SelectionState.HIGHLIGHTED;
const modelTrackContainer = this._traceViewer.trackView.modelTrackContainer_;
modelTrackContainer.viewport_.dispatchChangeEvent();
Expand Down

0 comments on commit a79bc43

Please sign in to comment.