diff options
| author | Naafiyan Ahmed <naafiyan@gmail.com> | 2022-06-05 19:41:06 -0400 |
|---|---|---|
| committer | Naafiyan Ahmed <naafiyan@gmail.com> | 2022-06-05 19:41:06 -0400 |
| commit | bf8f127f5aa906280fa12dc1ea2cc01bcf9ff40f (patch) | |
| tree | 31ad9380d313b181b5ceb375373fb12a9e174e47 /src/client/views/InkTranscription.tsx | |
| parent | a96858e3a83606d69a691d251f01f54ef39924e9 (diff) | |
refactored writing mode code
Diffstat (limited to 'src/client/views/InkTranscription.tsx')
| -rw-r--r-- | src/client/views/InkTranscription.tsx | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/src/client/views/InkTranscription.tsx b/src/client/views/InkTranscription.tsx index 54c899144..231ab694d 100644 --- a/src/client/views/InkTranscription.tsx +++ b/src/client/views/InkTranscription.tsx @@ -10,6 +10,7 @@ import { aggregateBounds } from '../../Utils'; import { CollectionFreeFormView } from './collections/collectionFreeForm'; import { DocumentManager } from "../util/DocumentManager"; import { InkingStroke } from './InkingStroke'; +import { groupInkDocs } from './nodes/button/FontIconBox'; export class InkTranscription extends React.Component { @@ -173,53 +174,7 @@ export class InkTranscription extends React.Component { if (!docView) return; const marqViewRef = docView._marqueeViewRef.current; if (!marqViewRef) return; - // 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 }); - })) - - const aggregBounds = aggregateBounds(bounds, 0, 0); - - if (marqViewRef) { - marqViewRef._downX = aggregBounds.x; - marqViewRef._downY = aggregBounds.y; - marqViewRef._lastX = aggregBounds.r; - marqViewRef._lastY = aggregBounds.b; - } - - // set the vals for bounds in marqueeView - - selected.map(action(d => { - const dx = NumCast(d.x); - const dy = NumCast(d.y); - delete d.x; - delete d.y; - delete d.activeFrame; - delete d._timecodeToShow; // bcz: this should be automatic somehow.. along with any other properties that were logically associated with the original collection - delete d._timecodeToHide; // bcz: this should be automatic somehow.. along with any other properties that were logically associated with the original collection - // calculate pos based on bounds - if (marqViewRef?.Bounds) { - d.x = dx - marqViewRef.Bounds.left - marqViewRef.Bounds.width / 2; - d.y = dy - marqViewRef.Bounds.top - marqViewRef.Bounds.height / 2; - } - return d; - })); - - docView.props.removeDocument?.(selected); - const newCollection = marqViewRef?.getCollection(selected, undefined, true); - if (newCollection) { - newCollection.height = newCollection[HeightSym](); - newCollection.width = newCollection[WidthSym](); - newCollection.title = word; - } - // nda - bug: when deleting a stroke before leaving writing mode, delete the stroke from unprocessed ink docs - newCollection && docView.props.addDocument?.(newCollection); + groupInkDocs(selected, docView, word); }); } |
