aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionDockingView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionDockingView.tsx')
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index f559480ed..77b698a07 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -18,7 +18,6 @@ import { SelectionManager } from '../../util/SelectionManager';
import { Transform } from '../../util/Transform';
import { undoBatch, UndoManager } from "../../util/UndoManager";
import { DocumentView } from "../nodes/DocumentView";
-import { CollectionViewType } from './CollectionBaseView';
import "./CollectionDockingView.scss";
import { SubCollectionViewProps } from "./CollectionSubView";
import { ParentDocSelector } from './ParentDocumentSelector';
@@ -410,10 +409,10 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
tab.reactComponents = [dragSpan, upDiv];
tab.element.append(dragSpan);
tab.element.append(upDiv);
- tab.reactionDisposer = reaction(() => [doc.title],
- () => {
- tab.titleElement[0].textContent = doc.title;
- }, { fireImmediately: true });
+ tab.reactionDisposer = reaction(() => [doc.title, Doc.IsBrushedDegree(doc)], () => {
+ tab.titleElement[0].textContent = doc.title, { fireImmediately: true };
+ tab.titleElement[0].style.outline = `${["transparent", "white", "white"][Doc.IsBrushedDegree(doc)]} ${["none", "dashed", "solid"][Doc.IsBrushedDegree(doc)]} 1px`;
+ });
//TODO why can't this just be doc instead of the id?
tab.titleElement[0].DashDocId = tab.contentItem.config.props.documentId;
}
@@ -421,9 +420,7 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
tab.titleElement[0].Tab = tab;
tab.closeElement.off('click') //unbind the current click handler
.click(async function () {
- if (tab.reactionDisposer) {
- tab.reactionDisposer();
- }
+ tab.reactionDisposer && tab.reactionDisposer();
let doc = await DocServer.GetRefField(tab.contentItem.config.props.documentId);
if (doc instanceof Doc) {
let theDoc = doc;
@@ -511,7 +508,7 @@ interface DockedFrameProps {
}
@observer
export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
- _mainCont = React.createRef<HTMLDivElement>();
+ _mainCont: HTMLDivElement | undefined = undefined;
@observable private _panelWidth = 0;
@observable private _panelHeight = 0;
@observable private _document: Opt<Doc>;
@@ -551,6 +548,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
private onActiveContentItemChanged() {
if (this.props.glContainer.tab) {
this._isActive = this.props.glContainer.tab.isActive;
+ !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.
}
}
@@ -569,9 +567,9 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
}
ScreenToLocalTransform = () => {
- if (this._mainCont.current && this._mainCont.current.children) {
- let { scale, translateX, translateY } = Utils.GetScreenTransform(this._mainCont.current.children[0].firstChild as HTMLElement);
- scale = Utils.GetScreenTransform(this._mainCont.current).scale;
+ if (this._mainCont && this._mainCont!.children) {
+ let { scale, translateX, translateY } = Utils.GetScreenTransform(this._mainCont.children[0].firstChild as HTMLElement);
+ scale = Utils.GetScreenTransform(this._mainCont).scale;
return CollectionDockingView.Instance.props.ScreenToLocalTransform().translate(-translateX, -translateY).scale(1 / this.contentScaling() / scale);
}
return Transform.Identity();
@@ -616,7 +614,13 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
@computed get content() {
return (
- <div className="collectionDockingView-content" ref={this._mainCont}
+ <div className="collectionDockingView-content" ref={action((ref: HTMLDivElement) => {
+ this._mainCont = ref;
+ if (ref) {
+ this._panelWidth = Number(getComputedStyle(ref).width!.replace("px", ""));
+ this._panelHeight = Number(getComputedStyle(ref).height!.replace("px", ""));
+ }
+ })}
style={{ transform: `translate(${this.previewPanelCenteringOffset}px, 0px)` }}>
{this.docView}
</div >);