mirror of
https://github.com/mathuo/dockview
synced 2025-05-02 09:38:26 +00:00
feat: primary/left click only to switch tabs
This commit is contained in:
parent
b5de6c7e43
commit
c6ddeb3c58
@ -151,7 +151,12 @@ export class TabsContainer
|
|||||||
if (event.defaultPrevented) {
|
if (event.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.accessor.doSetGroupActive(this.group);
|
|
||||||
|
const isLeftClick = event.button === 0;
|
||||||
|
|
||||||
|
if (isLeftClick) {
|
||||||
|
this.accessor.doSetGroupActive(this.group);
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
addDisposableListener(this.tabContainer, 'dragenter', (event) => {
|
addDisposableListener(this.tabContainer, 'dragenter', (event) => {
|
||||||
if (
|
if (
|
||||||
@ -273,6 +278,14 @@ export class TabsContainer
|
|||||||
const alreadyFocused =
|
const alreadyFocused =
|
||||||
panel.id === this.group.group.activePanel?.id &&
|
panel.id === this.group.group.activePanel?.id &&
|
||||||
this.group.group.isAncestor(focusedElement.element!);
|
this.group.group.isAncestor(focusedElement.element!);
|
||||||
|
this.accessor.fireMouseEvent({ ...event, panel, tab: true });
|
||||||
|
|
||||||
|
const isLeftClick = event.event.button === 0;
|
||||||
|
|
||||||
|
if (!isLeftClick || event.event.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (event.kind) {
|
switch (event.kind) {
|
||||||
case MouseEventKind.CLICK:
|
case MouseEventKind.CLICK:
|
||||||
this.group.group.openPanel(panel, {
|
this.group.group.openPanel(panel, {
|
||||||
@ -280,7 +293,6 @@ export class TabsContainer
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.accessor.fireMouseEvent({ ...event, panel, tab: true });
|
|
||||||
}),
|
}),
|
||||||
tab.onDropped((event) => {
|
tab.onDropped((event) => {
|
||||||
this._onDropped.fire({
|
this._onDropped.fire({
|
||||||
|
Loading…
Reference in New Issue
Block a user