diff options
author | eleanor-park <eleanor_park@brown.edu> | 2024-08-27 20:43:24 -0400 |
---|---|---|
committer | eleanor-park <eleanor_park@brown.edu> | 2024-08-27 20:43:24 -0400 |
commit | f5b04341893da68e50b0cbc72d77795209bfee3e (patch) | |
tree | bf3c5ca83af6a17371f3c9d5b215668c8db9a8d2 /src | |
parent | a21744ddbbc026b64b028b624c3d7c4000706a25 (diff) |
still trying to resolve merge issues
Diffstat (limited to 'src')
-rw-r--r-- | src/ClientUtils.ts | 2 | ||||
-rw-r--r-- | src/client/views/DocumentButtonBar.tsx | 2 | ||||
-rw-r--r-- | src/client/views/InkTranscription.tsx | 42 | ||||
-rw-r--r-- | src/client/views/LightboxView.tsx | 4 | ||||
-rw-r--r-- | src/client/views/PropertiesView.tsx | 2 | ||||
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 2 | ||||
-rw-r--r-- | src/client/views/collections/collectionFreeForm/MarqueeView.tsx | 4 | ||||
-rw-r--r-- | src/client/views/global/globalScripts.ts | 10 | ||||
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 4 | ||||
-rw-r--r-- | src/client/views/smartdraw/AnnotationPalette.tsx | 15 |
10 files changed, 54 insertions, 33 deletions
diff --git a/src/ClientUtils.ts b/src/ClientUtils.ts index 2b623625d..dc52218c5 100644 --- a/src/ClientUtils.ts +++ b/src/ClientUtils.ts @@ -462,7 +462,7 @@ export function addStyleSheetRule(sheet: CSSStyleSheet | null, selector: string, : Object.keys(css) .map(p => p + ':' + (p === 'content' ? "'" + css[p] + "'" : css[p])) .join(';'); - return sheet.insertRule(selectorPrefix + selector + '{' + propText + '}', sheet.cssRules.length); + return sheet?.insertRule(selectorPrefix + selector + '{' + propText + '}', sheet.cssRules.length); } export function removeStyleSheetRule(sheet: CSSStyleSheet | null, rule: number) { if (sheet?.rules.length) { diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx index c5901adc4..8aa4c2093 100644 --- a/src/client/views/DocumentButtonBar.tsx +++ b/src/client/views/DocumentButtonBar.tsx @@ -17,7 +17,7 @@ import { DictationManager } from '../util/DictationManager'; import { DragManager } from '../util/DragManager'; import { dropActionType } from '../util/DropActionTypes'; import { SharingManager } from '../util/SharingManager'; -import { UndoManager, undoable } from '../util/UndoManager'; +import { UndoManager, undoable, undoBatch } from '../util/UndoManager'; import './DocumentButtonBar.scss'; import { ObservableReactComponent } from './ObservableReactComponent'; import { PinProps } from './PinFuncs'; diff --git a/src/client/views/InkTranscription.tsx b/src/client/views/InkTranscription.tsx index 0735aa6d2..485a0e7c4 100644 --- a/src/client/views/InkTranscription.tsx +++ b/src/client/views/InkTranscription.tsx @@ -114,6 +114,7 @@ export class InkTranscription extends React.Component { const validInks = inkDocs.filter(s => s.type === DocumentType.INK); const strokes: InkData[] = []; + const times: number[] = []; validInks .filter(i => Cast(i[Doc.LayoutFieldKey(i)], InkField)) @@ -124,8 +125,22 @@ export class InkTranscription extends React.Component { times.push(DateCast(i.author_date).getDate().getTime()); }); console.log(strokes); - console.log(this.convertPointsToString(strokes)); - console.log(this.convertPointsToString2(strokes)); + console.log( + `this.Multistrokes.push( + new Multistroke( + Gestures.Scribble, + useBoundedRotationInvariance, + new Array([ + ` + + this.convertPointsToString(strokes) + + ` + ]) + ) + ) + ` + ); + //console.log(this.convertPointsToString(strokes)); + //console.log(this.convertPointsToString2(strokes)); this.currGroup = groupDoc; const pointerData = strokes.map((stroke, i) => this.inkJSON(stroke, times[i])); const processGestures = false; @@ -137,7 +152,7 @@ export class InkTranscription extends React.Component { } }; convertPointsToString(points: InkData[]): string { - return points[0].map(point => `new Point(${point.X}, ${point.Y})`).join(',\n '); + return points[0].map(point => `new Point(${point.X}, ${point.Y})`).join(','); } convertPointsToString2(points: InkData[]): string { return points[0].map(point => `(${point.X},${point.Y})`).join(','); @@ -312,11 +327,20 @@ export class InkTranscription extends React.Component { } }; -// if (this.currGroup) { -// this.currGroup.text = text; // transcription text -// this.currGroup.icon_fieldKey = 'transcription'; // use the transcription icon template when iconifying -// this.currGroup.title = text.split('\n')[0]; -// } + /** + * Creates the ink grouping once the user leaves the writing mode. + */ + createInkGroup() { + // TODO nda - if document being added to is a inkGrouping then we can just add to that group + if (Doc.ActiveTool === InkTool.Write) { + CollectionFreeFormView.collectionsWithUnprocessedInk.forEach(ffView => { + // TODO: nda - will probably want to go through ffView unprocessed docs and then see if any of the inksToGroup docs are in it and only use those + const selected = ffView.unprocessedDocs; + const newCollection = this.groupInkDocs( + selected.filter(doc => doc.embedContainer), + ffView + ); + ffView.unprocessedDocs = []; InkTranscription.Instance.transcribeInk(newCollection, selected, false); }); @@ -378,7 +402,7 @@ export class InkTranscription extends React.Component { ); docView.props.removeDocument?.(selected); // Gets a collection based on the selected nodes using a marquee view ref - const newCollection = MarqueeView.getCollection(selected, undefined, true, { left: 1, top: 1, width: 1, height: 1 }); + const newCollection = MarqueeView.getCollection(selected, undefined, true, { top: 1, left: 1, width: 1, height: 1 }); if (newCollection) { newCollection.width = NumCast(newCollection._width); newCollection.height = NumCast(newCollection._height); diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx index e947e822b..651fb5888 100644 --- a/src/client/views/LightboxView.tsx +++ b/src/client/views/LightboxView.tsx @@ -10,7 +10,7 @@ import { emptyFunction } from '../../Utils'; import { CreateLinkToActiveAudio, Doc, DocListCast, FieldResult, Opt, returnEmptyDoclist } from '../../fields/Doc'; import { Id } from '../../fields/FieldSymbols'; import { InkTool } from '../../fields/InkField'; -import { BoolCast, Cast, NumCast, toList } from '../../fields/Types'; +import { BoolCast, Cast, DocCast, NumCast, toList } from '../../fields/Types'; import { ScriptingGlobals } from '../util/ScriptingGlobals'; import { SnappingManager } from '../util/SnappingManager'; import { Transform } from '../util/Transform'; @@ -43,7 +43,7 @@ export class LightboxView extends ObservableReactComponent<LightboxViewProps> { public static Contains(view?: DocumentView) { return ( (view && LightboxView.Instance?._docView && (view.containerViewPath?.() ?? []).concat(view).includes(LightboxView.Instance?._docView)) || - (view && LightboxView.Instance?._annoPaletteView?.Contains(view)) + (view && LightboxView.Instance?._annoPaletteView?.Contains(view)) || undefined ); } // prettier-ignore public static LightboxDoc = () => LightboxView.Instance?._doc; diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index 6cf16825a..bbe422e9e 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -1018,7 +1018,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps @computed get dashdStk() { return this.containsInkDoc? this.inkDoc?.stroke_dash || '' : this.selectedDoc?.stroke_dash || ''; } // prettier-ignore set dashdStk(value) { - value && (this._lastDash = value); + value && (this._lastDash = value as string); if (this.containsInkDoc) { const childDocs = DocListCast(this.selectedDoc[DocData].data); childDocs.forEach(doc => { diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 453d44915..2963a8f53 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -32,7 +32,7 @@ import { CompileScript } from '../../../util/Scripting'; import { ScriptingGlobals } from '../../../util/ScriptingGlobals'; import { freeformScrollMode, SnappingManager } from '../../../util/SnappingManager'; import { Transform } from '../../../util/Transform'; -import { undoable, UndoManager } from '../../../util/UndoManager'; +import { undoable, undoBatch, UndoManager } from '../../../util/UndoManager'; import { Timeline } from '../../animationtimeline/Timeline'; import { ContextMenu } from '../../ContextMenu'; import { InkingStroke } from '../../InkingStroke'; diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index dbc88cb19..f85727661 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -6,7 +6,7 @@ import { intersectRect, unimplementedFunction } from '../../../../Utils'; import { Doc, DocListCast, Opt } from '../../../../fields/Doc'; import { AclAdmin, AclAugment, AclEdit, DocData } from '../../../../fields/DocSymbols'; import { Id } from '../../../../fields/FieldSymbols'; -import { InkTool } from '../../../../fields/InkField'; +import { InkData, InkTool } from '../../../../fields/InkField'; import { List } from '../../../../fields/List'; import { BoolCast, Cast, DocCast, NumCast, StrCast } from '../../../../fields/Types'; import { ImageField } from '../../../../fields/URLField'; @@ -464,7 +464,7 @@ export class MarqueeView extends ObservableReactComponent<SubCollectionViewProps let y_offset = 0; let row_count = 0; for (const label of labelGroups) { - const newCollection = this.getCollection([], undefined, false); + const newCollection = MarqueeView.getCollection([], undefined, false, { top: 1, left: 1, width: 1, height: 1 }); newCollection._width = 900; newCollection._height = 900; newCollection._x = this.Bounds.left; diff --git a/src/client/views/global/globalScripts.ts b/src/client/views/global/globalScripts.ts index 6722982e3..50319c466 100644 --- a/src/client/views/global/globalScripts.ts +++ b/src/client/views/global/globalScripts.ts @@ -15,7 +15,7 @@ import { ScriptingGlobals } from '../../util/ScriptingGlobals'; import { UndoManager, undoable } from '../../util/UndoManager'; import { GestureOverlay } from '../GestureOverlay'; import { InkingStroke } from '../InkingStroke'; -import { CollectionFreeFormView } from '../collections/collectionFreeForm'; +import { CollectionFreeFormView, MarqueeView } from '../collections/collectionFreeForm'; import { CollectionFreeFormDocumentView } from '../nodes/CollectionFreeFormDocumentView'; import { ActiveEraserWidth, @@ -36,7 +36,7 @@ import { ImageBox } from '../nodes/ImageBox'; import { VideoBox } from '../nodes/VideoBox'; import { WebBox } from '../nodes/WebBox'; import { RichTextMenu } from '../nodes/formattedText/RichTextMenu'; -import { InkTranscription } from '../InkTranscription'; +// import { InkTranscription } from '../InkTranscription'; // import { InkTranscription } from '../InkTranscription'; @@ -414,7 +414,7 @@ export function createInkGroup(/* inksToGroup?: Doc[], isSubGroup?: boolean */) ); ffView._props.removeDocument?.(selected); // TODO: nda - this is the code to actually get a new grouped collection - const newCollection = marqViewRef?.getCollection(selected, undefined, true); + const newCollection = MarqueeView.getCollection(selected, undefined, true, { top: 1, left: 1, width: 1, height: 1 }); if (newCollection) { newCollection.height = NumCast(newCollection._height); newCollection.width = NumCast(newCollection._width); @@ -425,14 +425,14 @@ export function createInkGroup(/* inksToGroup?: Doc[], isSubGroup?: boolean */) // TODO: nda - will probably need to go through and only remove the unprocessed selected docs ffView.unprocessedDocs = []; - InkTranscription.Instance.transcribeInk(newCollection, selected, false); + // InkTranscription.Instance.transcribeInk(newCollection, selected, false); }); } CollectionFreeFormView.collectionsWithUnprocessedInk.clear(); } function setActiveTool(tool: InkTool | Gestures, keepPrim: boolean, checkResult?: boolean) { - InkTranscription.Instance?.createInkGroup(); + // InkTranscription.Instance?.createInkGroup(); if (checkResult) { return (Doc.ActiveTool === tool && !GestureOverlay.Instance?.InkShape) || GestureOverlay.Instance?.InkShape === tool ? GestureOverlay.Instance?.KeepPrimitiveMode || ![Gestures.Circle, Gestures.Line, Gestures.Rectangle].includes(tool as Gestures) diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 791da7684..3ff3f49dc 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -52,7 +52,7 @@ import { OpenWhere, OpenWhereMod } from './OpenWhere'; import { FormattedTextBox } from './formattedText/FormattedTextBox'; import { PresEffect, PresEffectDirection } from './trails/PresEnums'; import SpringAnimation from './trails/SlideEffect'; -import { SpringSettings, SpringType, springMappings } from './trails/SpringUtils'; +import { SpringType, springMappings } from './trails/SpringUtils'; export interface DocumentViewProps extends FieldViewSharedProps { hideDecorations?: boolean; // whether to suppress all DocumentDecorations when doc is selected @@ -1087,8 +1087,6 @@ export class DocumentView extends DocComponent<DocumentViewProps>() { public static PinDoc: (docIn: Doc | Doc[], pinProps: PinProps) => void; // gesture public static DownDocView: DocumentView | undefined; // the first DocView that receives a pointerdown event. used by GestureOverlay to determine the doc a gesture should apply to. - // media playing - @observable public static CurrentlyPlaying: DocumentView[] = []; public get displayName() { return 'DocumentView(' + (this.Document?.title??"") + ')'; } // prettier-ignore public ContentRef = React.createRef<HTMLDivElement>(); diff --git a/src/client/views/smartdraw/AnnotationPalette.tsx b/src/client/views/smartdraw/AnnotationPalette.tsx index 7f00fa2f2..b57907152 100644 --- a/src/client/views/smartdraw/AnnotationPalette.tsx +++ b/src/client/views/smartdraw/AnnotationPalette.tsx @@ -1,20 +1,19 @@ import { faLaptopHouse } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Slider, Switch } from '@mui/material'; -import { Button, IconButton } from 'browndash-components'; -import { action, computed, makeObservable, observable } from 'mobx'; +import { Button } from 'browndash-components'; +import { action, makeObservable, observable } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; import { AiOutlineSend } from 'react-icons/ai'; import ReactLoading from 'react-loading'; -import { returnAll, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnTrue, returnZero } from '../../../ClientUtils'; -import { ActiveInkWidth, Doc, DocListCast, Opt, StrListCast } from '../../../fields/Doc'; +import { returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue } from '../../../ClientUtils'; +import { Doc, DocListCast } from '../../../fields/Doc'; import { DocData } from '../../../fields/DocSymbols'; -import { InkData, InkField } from '../../../fields/InkField'; -import { BoolCast, DocCast, ImageCast } from '../../../fields/Types'; -import { emptyFunction, unimplementedFunction } from '../../../Utils'; +import { ImageCast } from '../../../fields/Types'; +import { emptyFunction } from '../../../Utils'; import { Docs } from '../../documents/Documents'; -import { makeUserTemplateButton, makeUserTemplateImage } from '../../util/DropConverter'; +import { makeUserTemplateImage } from '../../util/DropConverter'; import { SettingsManager } from '../../util/SettingsManager'; import { Transform } from '../../util/Transform'; import { undoable, undoBatch } from '../../util/UndoManager'; |