aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MainView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-16 14:57:29 -0500
committerbobzel <zzzman@gmail.com>2023-11-16 14:57:29 -0500
commitf00096cea4613c13672ba5dbc0bd60c461c92603 (patch)
tree1f2838b628e1a0847ce9793a5765de7b13224301 /src/client/views/MainView.tsx
parent570e96292219a7c7c9fe496ba0606cc6b9f72abf (diff)
fixed alt-drag to toggle scroll mode. fixed replaceTab to work properly with panelNames. made slides pointing to trails open the target trails in situ. cleaned up code when starting drag to call freeformview more nicel. fixed brush/highlight of tabs. made collectionFreeformView/FreeformDocs use a more robust and simpler approach to caching freeform values.
Diffstat (limited to 'src/client/views/MainView.tsx')
-rw-r--r--src/client/views/MainView.tsx19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index f67bd3288..a6f0b9e84 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -26,7 +26,7 @@ import { RTFMarkup } from '../util/RTFMarkup';
import { ScriptingGlobals } from '../util/ScriptingGlobals';
import { SelectionManager } from '../util/SelectionManager';
import { ServerStats } from '../util/ServerStats';
-import { ColorScheme, SettingsManager } from '../util/SettingsManager';
+import { SettingsManager } from '../util/SettingsManager';
import { SharingManager } from '../util/SharingManager';
import { SnappingManager } from '../util/SnappingManager';
import { Transform } from '../util/Transform';
@@ -35,6 +35,7 @@ import { CollectionDockingView } from './collections/CollectionDockingView';
import { MarqueeOptionsMenu } from './collections/collectionFreeForm/MarqueeOptionsMenu';
import { CollectionLinearView } from './collections/collectionLinear';
import { CollectionMenu } from './collections/CollectionMenu';
+import { TabDocView } from './collections/TabDocView';
import './collections/TreeView.scss';
import { ComponentDecorations } from './ComponentDecorations';
import { ContextMenu } from './ContextMenu';
@@ -62,6 +63,7 @@ import { MapAnchorMenu } from './nodes/MapBox/MapAnchorMenu';
import { MapBox } from './nodes/MapBox/MapBox';
import { RadialMenu } from './nodes/RadialMenu';
import { TaskCompletionBox } from './nodes/TaskCompletedBox';
+import { PresBox } from './nodes/trails';
import { OverlayView } from './OverlayView';
import { AnchorMenu } from './pdf/AnchorMenu';
import { GPTPopup } from './pdf/GPTPopup/GPTPopup';
@@ -563,7 +565,7 @@ export class MainView extends React.Component {
@action
openPresentation = (pres: Doc) => {
if (pres.type === DocumentType.PRES) {
- CollectionDockingView.AddSplit(pres, OpenWhereMod.right);
+ CollectionDockingView.AddSplit(pres, OpenWhereMod.right, undefined, PresBox.PanelName);
Doc.MyTrails && (Doc.ActivePresentation = pres);
Doc.AddDocToList(Doc.MyTrails, 'data', pres);
this.closeFlyout();
@@ -696,16 +698,17 @@ export class MainView extends React.Component {
mainContainerXf = () => this.sidebarScreenToLocal().translate(-this.leftScreenOffsetOfMainDocView, 0);
static addDocTabFunc_impl = (doc: Doc, location: OpenWhere): boolean => {
const whereFields = location.split(':');
- const keyValue = whereFields[1]?.includes('KeyValue');
- const whereMods: OpenWhereMod = whereFields.length > 1 ? (whereFields[1].replace('KeyValue', '') as OpenWhereMod) : OpenWhereMod.none;
+ const keyValue = whereFields.includes(OpenWhereMod.keyvalue);
+ const whereMods = whereFields.length > 1 ? (whereFields[1] as OpenWhereMod) : OpenWhereMod.none;
+ const panelName = whereFields.length > 1 ? whereFields.lastElement() : '';
if (doc.dockingConfig && !keyValue) return DashboardView.openDashboard(doc);
- // prettier-ignore
switch (whereFields[0]) {
case OpenWhere.lightbox: return LightboxView.Instance.AddDocTab(doc, location);
case OpenWhere.close: return CollectionDockingView.CloseSplit(doc, whereMods);
- case OpenWhere.toggle: return CollectionDockingView.ToggleSplit(doc, whereMods, undefined, "dontSelectOnActivate"); // bcz: hack! mark the toggle so that it won't be selected on activation- this is needed so that the backlinks menu can toggle views of targets on and off without selecting them
+ case OpenWhere.toggle: return CollectionDockingView.ToggleSplit(doc, whereMods, undefined, TabDocView.DontSelectOnActivate); // bcz: hack! mark the toggle so that it won't be selected on activation- this is needed so that the backlinks menu can toggle views of targets on and off without selecting them
+ case OpenWhere.replace: return CollectionDockingView.ReplaceTab(doc, whereMods, undefined, panelName);
case OpenWhere.add:default:return CollectionDockingView.AddSplit(doc, whereMods, undefined, undefined, keyValue);
- }
+ } // prettier-ignore
};
@computed get flyout() {
@@ -923,7 +926,7 @@ export class MainView extends React.Component {
SnappingManager.GetIsDragging();
SnappingManager.GetIsResizing();
const dragged = DragManager.docsBeingDragged.lastElement() ?? SelectionManager.Docs().lastElement();
- const dragPar = dragged ? DocumentManager.Instance.getDocumentView(dragged)?.props.CollectionFreeFormDocumentView?.().props.CollectionFreeFormView : undefined;
+ const dragPar = dragged ? DocumentManager.Instance.getDocumentView(dragged)?.CollectionFreeFormView : undefined;
return !dragPar?.rootDoc.freeform_snapLines ? null : (
<div className="mainView-snapLines">
<svg style={{ width: '100%', height: '100%' }}>