diff options
| author | Zachary Zhang <zacharyzhang7@gmail.com> | 2024-07-18 14:21:54 -0400 |
|---|---|---|
| committer | Zachary Zhang <zacharyzhang7@gmail.com> | 2024-07-18 14:21:54 -0400 |
| commit | a0e9c3471c1a8adcb7cc68b430735e023fe35654 (patch) | |
| tree | 4144e2925acf2817f19e77dbc6c4eedc7cd126f6 /src/client/views/InkTranscription.tsx | |
| parent | 57fd540054ac7c102fec4b0da73854f018f8bbd3 (diff) | |
gesture improvements
Diffstat (limited to 'src/client/views/InkTranscription.tsx')
| -rw-r--r-- | src/client/views/InkTranscription.tsx | 19 |
1 files changed, 15 insertions, 4 deletions
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; } |
