diff options
| author | Andy Rickert <andrew_rickert@brown.edu> | 2020-06-03 16:40:09 -0400 |
|---|---|---|
| committer | Andy Rickert <andrew_rickert@brown.edu> | 2020-06-03 16:40:09 -0400 |
| commit | 954948ddd511578af4ca2c50c960765a5a7bc637 (patch) | |
| tree | 16fafd254a5db95d5c39838d4313d7ddf59753af /src/client/views/PreviewCursor.tsx | |
| parent | 6d8d3c00587c43ae61392db4fe6915ee492c2e4a (diff) | |
| parent | 9588e56079f7e4ab98da1849f44996656649bc06 (diff) | |
merge
Diffstat (limited to 'src/client/views/PreviewCursor.tsx')
| -rw-r--r-- | src/client/views/PreviewCursor.tsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx index f7a7944c9..dd65681d4 100644 --- a/src/client/views/PreviewCursor.tsx +++ b/src/client/views/PreviewCursor.tsx @@ -4,11 +4,11 @@ import "normalize.css"; import * as React from 'react'; import "./PreviewCursor.scss"; import { Docs } from '../documents/Documents'; -import { Doc } from '../../new_fields/Doc'; +import { Doc } from '../../fields/Doc'; import { Transform } from "../util/Transform"; import { DocServer } from '../DocServer'; import { undoBatch } from '../util/UndoManager'; -import { NumCast } from '../../new_fields/Types'; +import { NumCast } from '../../fields/Types'; @observer export class PreviewCursor extends React.Component<{}> { @@ -59,12 +59,15 @@ export class PreviewCursor extends React.Component<{}> { const pty = Number(strs[1].substring(0, strs[1].length - 1)); let count = 1; const list: Doc[] = []; + + let first: Doc | undefined; docids.map((did, i) => i && DocServer.GetRefField(did).then(doc => { count++; if (doc instanceof Doc) { + i === 1 && (first = doc); const alias = Doc.MakeClone(doc); - const deltaX = NumCast(doc.x) - ptx; - const deltaY = NumCast(doc.y) - pty; + const deltaX = NumCast(doc.x) - NumCast(first!.x) - ptx; + const deltaY = NumCast(doc.y) - NumCast(first!.y) - pty; alias.x = newPoint[0] + deltaX; alias.y = newPoint[1] + deltaY; list.push(alias); |
