/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import React, { PureComponent } from "devtools/client/shared/vendor/react"; import {
div,
ul,
li,
span,
} from "devtools/client/shared/vendor/react-dom-factories"; import PropTypes from "devtools/client/shared/vendor/react-prop-types"; import { connect } from "devtools/client/shared/vendor/react-redux";
import {
getSourceTabs,
getSelectedSource,
getSourcesForTabs,
getIsPaused,
getCurrentThread,
getBlackBoxRanges,
} from "../../selectors/index"; import { isVisible } from "../../utils/ui";
import { getHiddenTabs } from "../../utils/tabs"; import { isPretty, getFileURL } from "../../utils/source"; import actions from "../../actions/index";
import Tab from "./Tab"; import { PaneToggleButton } from "../shared/Button/index"; import Dropdown from "../shared/Dropdown"; import AccessibleImage from "../shared/AccessibleImage"; import CommandBar from "../SecondaryPanes/CommandBar";
/* * Updates the hiddenSourceTabs state, by * finding the source tabs which are wrapped and are not on the top row.
*/
updateHiddenTabs = () => { if (!this.refs.sourceTabs) { return;
} const { selectedSource, tabSources, moveTab } = this.props; const sourceTabEls = this.refs.sourceTabs.children; const hiddenTabs = getHiddenTabs(tabSources, sourceTabEls);
// Note that these three listener will be called from Tab component // so that e.target will be Tab's DOM (and not Tabs one).
onTabDragStart = e => { this.draggedSourceId = e.target.dataset.sourceId; this.draggedSourceIndex = e.target.dataset.index;
};
if (hoveredTabIndex === this.draggedSourceIndex) { return;
}
const tabDOMRect = e.target.getBoundingClientRect(); const { pageX: mouseCursorX } = e; if ( /* Case: the mouse cursor moves into the left half of any target tab */
mouseCursorX - tabDOMRect.left <
tabDOMRect.width / 2
) { // The current tab goes to the left of the target tab const targetTab =
hoveredTabIndex > this.draggedSourceIndex
? hoveredTabIndex - 1
: hoveredTabIndex;
moveTabBySourceId(this.draggedSourceId, targetTab); this.draggedSourceIndex = targetTab;
} elseif ( /* Case: the mouse cursor moves into the right half of any target tab */
mouseCursorX - tabDOMRect.left >=
tabDOMRect.width / 2
) { // The current tab goes to the right of the target tab const targetTab =
hoveredTabIndex < this.draggedSourceIndex
? hoveredTabIndex + 1
: hoveredTabIndex;
moveTabBySourceId(this.draggedSourceId, targetTab); this.draggedSourceIndex = targetTab;
}
};
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.23Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.