mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 19:19:59 +02:00
Rename tabSwitchView to tabRearrangeView
This commit is contained in:
parent
e5502d1a9b
commit
c8e3885110
1 changed files with 14 additions and 14 deletions
|
@ -185,10 +185,10 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
if (node.children) node.children.forEach(c => this._removeNodeSplitters(c));
|
if (node.children) node.children.forEach(c => this._removeNodeSplitters(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
enableTabSwitchView() {
|
enableTabRearrangeView() {
|
||||||
if (this.switchViewEnabled) return;
|
if (this.rearrangeViewEnabled) return;
|
||||||
this.switchViewEnabled = true;
|
this.rearrangeViewEnabled = true;
|
||||||
this.switchViewView = this.currentView;
|
this.rearrangeViewView = this.currentView;
|
||||||
if (!this._thumnailCanvas) {
|
if (!this._thumnailCanvas) {
|
||||||
this._thumnailCanvas = document.createElement("canvas");
|
this._thumnailCanvas = document.createElement("canvas");
|
||||||
this._thumnailCanvas.width = 280 * devicePixelRatio;
|
this._thumnailCanvas.width = 280 * devicePixelRatio;
|
||||||
|
@ -204,30 +204,30 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
this.tabBrowserPanel.addEventListener('dragover', this.onBrowserDragOver);
|
this.tabBrowserPanel.addEventListener('dragover', this.onBrowserDragOver);
|
||||||
this.tabBrowserPanel.addEventListener('drop', this.onBrowserDrop);
|
this.tabBrowserPanel.addEventListener('drop', this.onBrowserDrop);
|
||||||
this.tabBrowserPanel.addEventListener('dragend', this.onBrowserDragEnd)
|
this.tabBrowserPanel.addEventListener('dragend', this.onBrowserDragEnd)
|
||||||
this.tabBrowserPanel.addEventListener('click', this.disableTabSwitchView);
|
this.tabBrowserPanel.addEventListener('click', this.disableTabRearrangeView);
|
||||||
}
|
}
|
||||||
|
|
||||||
disableTabSwitchView = (event = null) => {
|
disableTabRearrangeView = (event = null) => {
|
||||||
if (!this.switchViewEnabled) return;
|
if (!this.rearrangeViewEnabled) return;
|
||||||
if (event) {
|
if (event) {
|
||||||
if (event.type === 'click' && event.button !== 0) return;
|
if (event.type === 'click' && event.button !== 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.switchViewEnabled || (event && event.target.classList.contains('zen-split-view-splitter'))) {
|
if (!this.rearrangeViewEnabled || (event && event.target.classList.contains('zen-split-view-splitter'))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tabBrowserPanel.removeEventListener('dragstart', this.onBrowserDragStart);
|
this.tabBrowserPanel.removeEventListener('dragstart', this.onBrowserDragStart);
|
||||||
this.tabBrowserPanel.removeEventListener('dragover', this.onBrowserDragOver);
|
this.tabBrowserPanel.removeEventListener('dragover', this.onBrowserDragOver);
|
||||||
this.tabBrowserPanel.removeEventListener('drop', this.onBrowserDrop);
|
this.tabBrowserPanel.removeEventListener('drop', this.onBrowserDrop);
|
||||||
this.tabBrowserPanel.removeEventListener('click', this.disableTabSwitchView);
|
this.tabBrowserPanel.removeEventListener('click', this.disableTabRearrangeView);
|
||||||
const browsers = this._data[this.switchViewView].tabs.map(t => t.linkedBrowser);
|
const browsers = this._data[this.rearrangeViewView].tabs.map(t => t.linkedBrowser);
|
||||||
browsers.forEach(b => {
|
browsers.forEach(b => {
|
||||||
b.style.pointerEvents = '';
|
b.style.pointerEvents = '';
|
||||||
b.style.opacity = '';
|
b.style.opacity = '';
|
||||||
});
|
});
|
||||||
this.switchViewEnabled = false;
|
this.rearrangeViewEnabled = false;
|
||||||
this.switchViewView = null;
|
this.rearrangeViewView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
onBrowserDragStart = (event) => {
|
onBrowserDragStart = (event) => {
|
||||||
|
@ -666,7 +666,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
this.deactivateCurrentSplitView();
|
this.deactivateCurrentSplitView();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.disableTabSwitchView();
|
this.disableTabRearrangeView();
|
||||||
this.activateSplitView(this._data[newView]);
|
this.activateSplitView(this._data[newView]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,7 +863,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
* @param {Event} event - The event.
|
* @param {Event} event - The event.
|
||||||
*/
|
*/
|
||||||
handleTabEvent = (event) => {
|
handleTabEvent = (event) => {
|
||||||
if (this.switchViewEnabled || (event.type === 'mouseover' && !this.canChangeTabOnHover)) {
|
if (this.rearrangeViewEnabled || (event.type === 'mouseover' && !this.canChangeTabOnHover)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const container = event.currentTarget;
|
const container = event.currentTarget;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue