aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/TabDocView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-09 17:34:35 -0400
committerbobzel <zzzman@gmail.com>2020-09-09 17:34:35 -0400
commite650f4dddb6a5f30b8eac0c6097cead28e04cd48 (patch)
treef015b71920a0ff6a0d5a7124b00acb4f8dc1001b /src/client/views/collections/TabDocView.tsx
parent54c02b71da4e7a698e0d5d7ecf66ab3fd082edf6 (diff)
parent19751f41b642ad68e8029e6ea618232543a02ad8 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/collections/TabDocView.tsx')
-rw-r--r--src/client/views/collections/TabDocView.tsx18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index fb4f5c366..589649ad9 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -68,7 +68,6 @@ export class TabDocView extends React.Component<TabDocViewProps> {
tab.element[0].onmouseenter = (e: MouseEvent) => {
if (SnappingManager.GetIsDragging() && tab.contentItem !== tab.header.parent.getActiveContentItem()) {
tab.header.parent.setActiveContentItem(tab.contentItem);
- console.log("Seetting " + titleEle.value);
tab.setActive(true);
}
};
@@ -88,7 +87,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
(document.activeElement !== titleEle) && titleEle.focus();
}
};
- tab._disposers.selectionDisposer = reaction(() => SelectionManager.SelectedDocuments().some(v => v.topMost && v.props.Document === doc),
+ tab._disposers.selectionDisposer = reaction(() => SelectionManager.SelectedDocuments().some(v => (v.topMost || v.props.treeViewDoc) && v.props.Document === doc),
(selected) => selected && tab.contentItem !== tab.header.parent.getActiveContentItem() &&
UndoManager.RunInBatch(() => tab.header.parent.setActiveContentItem(tab.contentItem), "tab switch"));
@@ -190,9 +189,9 @@ export class TabDocView extends React.Component<TabDocViewProps> {
private onActiveContentItemChanged() {
if (this.props.glContainer.tab && this._isActive !== this.props.glContainer.tab.isActive) {
this._isActive = this.props.glContainer.tab.isActive;
- this._isActive && setTimeout(() => this.view && SelectionManager.SelectDoc(this.view, false), 0);
(CollectionDockingView.Instance as any)._goldenLayout?.isInitialised && CollectionDockingView.Instance.stateChanged();
!this._isActive && this._document && Doc.UnBrushDoc(this._document); // bcz: bad -- trying to simulate a pointer leave event when a new tab is opened up on top of an existing one.
+ this._isActive && this.view && SelectionManager.SelectDoc(this.view, false);
}
}
@@ -228,8 +227,8 @@ export class TabDocView extends React.Component<TabDocViewProps> {
}
return Transform.Identity();
}
- get previewPanelCenteringOffset() { return this.nativeWidth() ? (this._panelWidth - this.nativeWidth() * this.contentScaling()) / 2 : 0; }
- get widthpercent() { return this.nativeWidth() ? `${(this.nativeWidth() * this.contentScaling()) / this._panelWidth * 100}% ` : undefined; }
+ @computed get previewPanelCenteringOffset() { return this.nativeWidth() ? (this._panelWidth - this.nativeWidth() * this.contentScaling()) / 2 : 0; }
+ @computed get widthpercent() { return this.nativeWidth() ? `${(this.nativeWidth() * this.contentScaling()) / this._panelWidth * 100}% ` : undefined; }
// adds a tab to the layout based on the locaiton parameter which can be:
// close[:{left,right,top,bottom}] - e.g., "close" will close the tab, "close:left" will close the left tab,
@@ -306,8 +305,6 @@ export class TabDocView extends React.Component<TabDocViewProps> {
ContentScaling={returnOne}
PanelWidth={this.returnMiniSize}
PanelHeight={this.returnMiniSize}
- NativeHeight={returnZero}
- NativeWidth={returnZero}
ScreenToLocalTransform={this.ScreenToLocalTransform}
renderDepth={0}
whenActiveChanged={emptyFunction}
@@ -332,6 +329,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
}
focusFunc = (doc: Doc, willZoom: boolean, scale?: number, afterFocus?: () => void) => afterFocus?.();
setView = action((view: DocumentView) => this._view = view);
+ active = () => this._isActive;
@computed get docView() {
TraceMobx();
return !this._document || this._document._viewType === CollectionViewType.Docking ? (null) :
@@ -347,11 +345,11 @@ export class TabDocView extends React.Component<TabDocViewProps> {
ContentScaling={this.contentScaling}
PanelWidth={this.panelWidth}
PanelHeight={this.panelHeight}
- NativeHeight={this.nativeHeight}
- NativeWidth={this.nativeWidth}
+ NativeHeight={this.nativeHeight() ? this.nativeHeight : undefined}
+ NativeWidth={this.nativeWidth() ? this.nativeWidth : undefined}
ScreenToLocalTransform={this.ScreenToLocalTransform}
renderDepth={0}
- parentActive={returnTrue}
+ parentActive={this.active}
whenActiveChanged={emptyFunction}
focus={this.focusFunc}
backgroundColor={CollectionDockingView.Instance.props.backgroundColor}