diff options
author | mehekj <mehek.jethani@gmail.com> | 2022-04-14 18:06:34 -0400 |
---|---|---|
committer | mehekj <mehek.jethani@gmail.com> | 2022-04-14 18:06:34 -0400 |
commit | ab5a0bd7cee9366dabf4ce40bde89b67730da2a5 (patch) | |
tree | 403fa68332cd174818535ce0643fdabaa041dd53 /src/client/views/nodes/button/FontIconBox.tsx | |
parent | dd3015568c95fbafdfeace835f82f5032bd61aef (diff) |
auto transcribes on grouping
Diffstat (limited to 'src/client/views/nodes/button/FontIconBox.tsx')
-rw-r--r-- | src/client/views/nodes/button/FontIconBox.tsx | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx index 862c16050..fc358f106 100644 --- a/src/client/views/nodes/button/FontIconBox.tsx +++ b/src/client/views/nodes/button/FontIconBox.tsx @@ -26,6 +26,7 @@ import { EditableView } from '../../EditableView'; import { GestureOverlay } from '../../GestureOverlay'; import { Colors } from '../../global/globalEnums'; import { ActiveFillColor, ActiveInkColor, ActiveInkWidth, SetActiveFillColor, SetActiveInkColor, SetActiveInkWidth } from '../../InkingStroke'; +import { InkTranscription } from '../../InkTranscription'; import { StyleProp } from '../../StyleProvider'; import { FieldView, FieldViewProps } from '.././FieldView'; import { RichTextMenu } from '../formattedText/RichTextMenu'; @@ -702,9 +703,9 @@ export function checkInksToGroup() { if (CurrentUserUtils.SelectedTool === 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 - // find all inkDocs in ffView.unprocessedDocs that are within 200 pixels of each other - const inksToGroup = ffView.unprocessedDocs.filter(inkDoc => { - console.log(inkDoc.x, inkDoc.y); + // find all inkDocs in ffView.unprocessedDocs that are within 200 pixels of each other + const inksToGroup = ffView.unprocessedDocs.filter(inkDoc => { + console.log(inkDoc.x, inkDoc.y); }); }); } @@ -718,26 +719,26 @@ export function createInkGroup(inksToGroup?: Doc[]) { const selected = ffView.unprocessedDocs; // loop through selected an get the bound const bounds: { x: number, y: number, width?: number, height?: number }[] = [] - + selected.map(action(d => { const x = NumCast(d.x); const y = NumCast(d.y); const width = d[WidthSym](); const height = d[HeightSym](); - bounds.push({x, y, width, height}); + bounds.push({ x, y, width, height }); })) - + const aggregBounds = aggregateBounds(bounds, 0, 0); const marqViewRef = ffView._marqueeViewRef.current; - + // set the vals for bounds in marqueeView if (marqViewRef) { marqViewRef._downX = aggregBounds.x; marqViewRef._downY = aggregBounds.y; marqViewRef._lastX = aggregBounds.r; marqViewRef._lastY = aggregBounds.b; - } - + } + selected.map(action(d => { const dx = NumCast(d.x); const dy = NumCast(d.y); @@ -756,11 +757,13 @@ export function createInkGroup(inksToGroup?: Doc[]) { ffView.props.removeDocument?.(selected); // TODO: nda - this is the code to actually get a new grouped collection const newCollection = marqViewRef?.getCollection(selected, undefined, [], true); - + // nda - bug: when deleting a stroke before leaving writing mode, delete the stroke from unprocessed ink docs newCollection && ffView.props.addDocument?.(newCollection); // TODO: nda - will probably need to go through and only remove the unprocessed selected docs ffView.unprocessedDocs = []; + + InkTranscription.Instance.transcribeInk(newCollection, selected, false); }); } CollectionFreeFormView.collectionsWithUnprocessedInk.clear(); @@ -780,7 +783,7 @@ ScriptingGlobals.add(function setActiveInkTool(tool: string, checkResult?: boole // const selected = ffView.unprocessedDocs; // // loop through selected an get the bound // const bounds: { x: number, y: number, width?: number, height?: number }[] = [] - + // selected.map(action(d => { // const x = NumCast(d.x); // const y = NumCast(d.y); @@ -788,10 +791,10 @@ ScriptingGlobals.add(function setActiveInkTool(tool: string, checkResult?: boole // const height = d[HeightSym](); // bounds.push({x, y, width, height}); // })) - + // const aggregBounds = aggregateBounds(bounds, 0, 0); // const marqViewRef = ffView._marqueeViewRef.current; - + // // set the vals for bounds in marqueeView // if (marqViewRef) { // marqViewRef._downX = aggregBounds.x; @@ -799,7 +802,7 @@ ScriptingGlobals.add(function setActiveInkTool(tool: string, checkResult?: boole // marqViewRef._lastX = aggregBounds.r; // marqViewRef._lastY = aggregBounds.b; // } - + // selected.map(action(d => { // const dx = NumCast(d.x); // const dy = NumCast(d.y); @@ -818,7 +821,7 @@ ScriptingGlobals.add(function setActiveInkTool(tool: string, checkResult?: boole // ffView.props.removeDocument?.(selected); // // TODO: nda - this is the code to actually get a new grouped collection // const newCollection = marqViewRef?.getCollection(selected, undefined, [], true); - + // // nda - bug: when deleting a stroke before leaving writing mode, delete the stroke from unprocessed ink docs // newCollection && ffView.props.addDocument?.(newCollection); // ffView.unprocessedDocs = []; |