diff options
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/views/GestureOverlay.tsx | 8 | ||||
| -rw-r--r-- | src/client/views/InkTranscription.tsx | 19 | ||||
| -rw-r--r-- | src/client/views/MainView.tsx | 2 |
3 files changed, 24 insertions, 5 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx index e3e252593..e961bc031 100644 --- a/src/client/views/GestureOverlay.tsx +++ b/src/client/views/GestureOverlay.tsx @@ -94,6 +94,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil @action onPointerDown = (e: React.PointerEvent) => { + console.log('pointerdown'); if (!(e.target as any)?.className?.toString().startsWith('lm_')) { if ([InkTool.Highlighter, InkTool.Pen, InkTool.Write].includes(Doc.ActiveTool)) { this._points.push({ X: e.clientX, Y: e.clientY }); @@ -132,6 +133,7 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil } @action onPointerUp = () => { + console.log('pointer up'); DocumentView.DownDocView = undefined; if (this._points.length > 1) { const B = this.svgBounds; @@ -147,7 +149,9 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil else { // need to decide when to turn gestures back on const result = points.length > 2 && GestureUtils.GestureRecognizer.Recognize([points]); + console.log(points); let actionPerformed = false; + console.log(result); if (Doc.UserDoc().recognizeGestures && result && result.Score > 0.7) { switch (result.Name) { case Gestures.Line: @@ -156,10 +160,14 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil case Gestures.Circle: this.makeBezierPolygon(result.Name, true); actionPerformed = this.dispatchGesture(result.Name); + console.log(result.Name); + console.log(); break; case Gestures.Scribble: console.log('scribble'); break; + case Gestures.RightAngle: + console.log('RightAngle'); default: } } diff --git a/src/client/views/InkTranscription.tsx b/src/client/views/InkTranscription.tsx index f07f7c0a7..3f90df7d1 100644 --- a/src/client/views/InkTranscription.tsx +++ b/src/client/views/InkTranscription.tsx @@ -123,10 +123,11 @@ export class InkTranscription extends React.Component { strokes.push(d.inkData.map(pd => inkStroke.ptToScreen({ X: pd.X, Y: pd.Y }))); times.push(DateCast(i.author_date).getDate().getTime()); }); - + console.log(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])); - console.log(JSON.stringify(pointerData)); const processGestures = false; if (math) { console.log('math'); @@ -135,6 +136,12 @@ export class InkTranscription extends React.Component { this.iinkEditor.importPointEvents(pointerData); } }; + convertPointsToString(points: InkData[]): string { + return points[0].map(point => `new Point(${point.X}, ${point.Y})`).join(',\n '); + } + convertPointsToString2(points: InkData[]): string { + return points[0].map(point => `(${point.X},${point.Y})`).join(','); + } /** * Converts the Dash Ink Data to JSON. @@ -253,6 +260,8 @@ export class InkTranscription extends React.Component { this.currGroup.title = text; let image = await this.getIcon(); const pathname = image?.url.href as string; + console.log(image?.url); + console.log(image); const { href } = (image as URLField).url; const hrefParts = href.split('.'); const hrefComplete = `${hrefParts[0]}_o.${hrefParts[1]}`; @@ -267,7 +276,7 @@ export class InkTranscription extends React.Component { const textBoxText = 'iink: ' + text + '\n' + '\n' + 'ChatGPT: ' + response; if (!this.currGroup.hasTextBox) { const newDoc = Docs.Create.TextDocument(textBoxText, { title: '', x: this.currGroup.x as number, y: (this.currGroup.y as number) + (this.currGroup.height as number) }); - newDoc.width = 100; + newDoc.height = 200; this.collectionFreeForm?.addDocument(newDoc); this.currGroup.hasTextBox = true; } @@ -278,9 +287,11 @@ export class InkTranscription extends React.Component { }; async getIcon() { const docView = DocumentView.getDocumentView(this.currGroup); + console.log(this.currGroup); if (docView) { + console.log(docView); docView.ComponentView?.updateIcon?.(); - return new Promise<ImageField | undefined>(res => setTimeout(() => res(ImageCast(docView.Document.icon)), 500)); + return new Promise<ImageField | undefined>(res => setTimeout(() => res(ImageCast(docView.Document.icon)), 1000)); } return undefined; } diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 8a3b0f27c..f8c7fd7b1 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -1097,7 +1097,7 @@ export class MainView extends ObservableReactComponent<{}> { <MarqueeOptionsMenu /> <TimelineMenu /> <RichTextMenu /> - <InkTranscription/> + <InkTranscription /> {this.snapLines} <LightboxView key="lightbox" PanelWidth={this._windowWidth} addSplit={CollectionDockingView.AddSplit} PanelHeight={this._windowHeight} maxBorder={this.lightboxMaxBorder} /> <GPTPopup key="gptpopup" /> |
