diff options
-rw-r--r-- | src/client/util/RichTextSchema.tsx | 6 | ||||
-rw-r--r-- | src/client/views/collections/CollectionDockingView.tsx | 6 | ||||
-rw-r--r-- | src/client/views/collections/CollectionSchemaCells.tsx | 1 | ||||
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 9 | ||||
-rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 4 | ||||
-rw-r--r-- | src/client/views/nodes/ImageBox.scss | 23 | ||||
-rw-r--r-- | src/client/views/nodes/ImageBox.tsx | 7 | ||||
-rw-r--r-- | src/client/views/nodes/KeyValuePair.tsx | 1 | ||||
-rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 1 | ||||
-rw-r--r-- | src/new_fields/documentSchemas.ts | 3 | ||||
-rw-r--r-- | src/new_fields/util.ts | 2 |
11 files changed, 37 insertions, 26 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx index 4612f2885..189bf08f7 100644 --- a/src/client/util/RichTextSchema.tsx +++ b/src/client/util/RichTextSchema.tsx @@ -671,15 +671,15 @@ export class DashDocCommentView { this._collapsed.className = "formattedTextBox-inlineComment"; this._collapsed.id = "DashDocCommentView-" + node.attrs.docid; this._view = view; - let targetNode = () => { + const targetNode = () => { for (let i = getPos() + 1; i < view.state.doc.nodeSize; i++) { - let m = view.state.doc.nodeAt(i); + const m = view.state.doc.nodeAt(i); if (m && m.type === view.state.schema.nodes.dashDoc && m.attrs.docid === node.attrs.docid) { return { node: m, pos: i } as { node: any, pos: number }; } } return undefined; - } + }; this._collapsed.onpointerdown = (e: any) => { const target = targetNode(); if (target) { diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index e35dc4c00..4374cde3c 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -529,7 +529,7 @@ interface DockedFrameProps { documentId: FieldId; dataDocumentId: FieldId; glContainer: any; - libraryPath: (FieldId[]) + libraryPath: (FieldId[]); //collectionDockingView: CollectionDockingView } @observer @@ -558,8 +558,8 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> { async setupLibraryPath() { Promise.all(this.props.libraryPath.map(async docid => { - let d = await DocServer.GetRefField(docid); - return d instanceof Doc ? d : undefined + const d = await DocServer.GetRefField(docid); + return d instanceof Doc ? d : undefined; })).then(action((list: (Doc | undefined)[]) => this._libraryPath = list.filter(d => d).map(d => d as Doc))); } diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index 1700c14cf..171dc4606 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -143,6 +143,7 @@ export class CollectionSchemaCell extends React.Component<CellProps> { const props: FieldViewProps = { Document: this.props.rowProps.original, DataDoc: this.props.rowProps.original, + LibraryPath: [], fieldKey: this.props.rowProps.column.id as string, ruleProvider: undefined, ContainingCollectionView: this.props.CollectionView, diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index fef365bf3..9f5b86e8d 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -528,8 +528,13 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu SelectionManager.SelectDoc(this, false); } }); - let path = this.props.LibraryPath.reduce((p: string, d: Doc) => p + "/" + (Doc.AreProtosEqual(d, (Doc.UserDoc().LibraryBtn as Doc).sourcePanel as Doc) ? "" : d.title), ""); - cm.addItem({ description: `path: ${path}`, event: () => { }, icon: "check" }) + const path = this.props.LibraryPath.reduce((p: string, d: Doc) => p + "/" + (Doc.AreProtosEqual(d, (Doc.UserDoc().LibraryBtn as Doc).sourcePanel as Doc) ? "" : d.title), ""); + cm.addItem({ + description: `path: ${path}`, event: () => { + this.props.LibraryPath.map(lp => Doc.GetProto(lp).treeViewOpen = lp.treeViewOpen = true); + Doc.BrushDoc(this.props.Document); + }, icon: "check" + }); } // does Document set a layout prop diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 481ae441e..e7c59ccb4 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -376,8 +376,8 @@ export class FormattedTextBox extends DocAnnotatableComponent<(FieldViewProps & e.preventDefault(); // prevents text from being selected during drag } sidebarMove = (e: PointerEvent) => { - let bounds = this.CurrentDiv.getBoundingClientRect(); - this._sidebarMovement += Math.sqrt((e.clientX - this._lastX) * (e.clientX - this._lastX) + (e.clientY - this._lastY) * (e.clientY - this._lastY)) + const bounds = this.CurrentDiv.getBoundingClientRect(); + this._sidebarMovement += Math.sqrt((e.clientX - this._lastX) * (e.clientX - this._lastX) + (e.clientY - this._lastY) * (e.clientY - this._lastY)); this.props.Document.sidebarWidthPercent = "" + 100 * (1 - (e.clientX - bounds.left) / bounds.width) + "%"; } sidebarUp = (e: PointerEvent) => { diff --git a/src/client/views/nodes/ImageBox.scss b/src/client/views/nodes/ImageBox.scss index 3b42c2352..cf5d999a7 100644 --- a/src/client/views/nodes/ImageBox.scss +++ b/src/client/views/nodes/ImageBox.scss @@ -1,13 +1,22 @@ -.imageBox { +.imageBox, .imageBox-dragging{ pointer-events: all; border-radius: inherit; width:100%; height:100%; position: absolute; transform-origin: top left; + .imageBox-fader { + pointer-events: all; + } } -.imageBox-cont, .imageBox-cont-dragging { +.imageBox-dragging { + .imageBox-fader { + pointer-events: none; + } +} + +.imageBox-cont { padding: 0vw; position: absolute; text-align: center; @@ -22,15 +31,6 @@ width: 100%; pointer-events: all; } - .imageBox-fader { - pointer-events: all; - } -} - -.imageBox-cont-dragging { - .imageBox-fader { - pointer-events: none; - } } .imageBox-dot { @@ -43,7 +43,6 @@ background: gray; } - #google-photos { transition: all 0.5s ease 0s; width: 30px; diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index b4a51657f..f60888929 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -308,7 +308,6 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum if (field instanceof ImageField) paths = [[this.choosePath(field.url), nativeWidth / nativeHeight]]; paths.push(...altpaths); // } - const dragging = !SelectionManager.GetIsDragging() ? "" : "-dragging"; const rotation = NumCast(this.Document.rotation, 0); const aspect = (rotation % 180) ? this.Document[HeightSym]() / this.Document[WidthSym]() : 1; const shift = (rotation % 180) ? (nativeHeight - nativeWidth / aspect) / 2 : 0; @@ -318,7 +317,7 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum !this.Document.ignoreAspect && this.resize(srcpath); - return <div className={`imageBox-cont${dragging}`} key={this.props.Document[Id]} ref={this.createDropTarget} onContextMenu={this.specificContextMenu}> + return <div className="imageBox-cont" key={this.props.Document[Id]} ref={this.createDropTarget} onContextMenu={this.specificContextMenu}> <div className="imageBox-fader" > <img key={this._smallRetryCount + (this._mediumRetryCount << 4) + (this._largeRetryCount << 8)} // force cache to update on retrys src={srcpath} @@ -350,7 +349,9 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum contentFunc = () => [this.content]; render() { - return (<div className="imageBox" onContextMenu={this.specificContextMenu} + TraceMobx(); + const dragging = !SelectionManager.GetIsDragging() ? "" : "-dragging"; + return (<div className={`imageBox${dragging}`} onContextMenu={this.specificContextMenu} style={{ transform: `scale(${this.props.ContentScaling()})`, width: `${100 / this.props.ContentScaling()}%`, diff --git a/src/client/views/nodes/KeyValuePair.tsx b/src/client/views/nodes/KeyValuePair.tsx index bca68cdd9..3e253b83a 100644 --- a/src/client/views/nodes/KeyValuePair.tsx +++ b/src/client/views/nodes/KeyValuePair.tsx @@ -56,6 +56,7 @@ export class KeyValuePair extends React.Component<KeyValuePairProps> { const props: FieldViewProps = { Document: this.props.doc, DataDoc: this.props.doc, + LibraryPath: [], ContainingCollectionView: undefined, ContainingCollectionDoc: undefined, ruleProvider: undefined, diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 69aacc902..3aa5d1d2c 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -634,6 +634,7 @@ export class PDFViewer extends DocAnnotatableComponent<IViewerProps, PdfDocument @computed get overlayLayer() { return <div className={`pdfViewer-overlay${InkingControl.Instance.selectedTool !== InkTool.None ? "-inking" : ""}`} id="overlay" style={{ transform: `scale(${this._zoomed})` }}> <CollectionFreeFormView {...this.props} + LibraryPath={this.props.ContainingCollectionView?.props.LibraryPath ?? []} annotationsKey={this.annotationsKey} setPreviewCursor={this.setPreviewCursor} PanelHeight={this.panelWidth} diff --git a/src/new_fields/documentSchemas.ts b/src/new_fields/documentSchemas.ts index 4c2f061a6..5c2ba6111 100644 --- a/src/new_fields/documentSchemas.ts +++ b/src/new_fields/documentSchemas.ts @@ -27,6 +27,9 @@ export const documentSchema = createSchema({ isTemplateField: "boolean", // whether this document acts as a template layout for describing how other documents should be displayed isBackground: "boolean", // whether document is a background element and ignores input events (can only selet with marquee) type: "string", // enumerated type of document + treeViewOpen: "boolean", // flag denoting whether the documents sub-tree (contents) is visible or hidden + treeViewExpandedView: "string", // name of field whose contents are being displayed as the document's subtree + preventTreeViewOpen: "boolean", // ignores the treeViewOpen flag (for allowing a view to not be slaved to other views of the document) currentTimecode: "number", // current play back time of a temporal document (video / audio) summarizedDocs: listSpec(Doc), // documents that are summarized by this document (and which will typically be opened by clicking this document) maximizedDocs: listSpec(Doc), // documents to maximize when clicking this document (generally this document will be an icon) diff --git a/src/new_fields/util.ts b/src/new_fields/util.ts index 4147be278..7bd9ef8da 100644 --- a/src/new_fields/util.ts +++ b/src/new_fields/util.ts @@ -13,7 +13,7 @@ function _readOnlySetter(): never { } export function TraceMobx() { - //trace(); + trace(); } export interface GetterResult { |