aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
diff options
context:
space:
mode:
authoreleanor-park <eleanor_park@brown.edu>2024-06-06 13:14:41 -0400
committereleanor-park <eleanor_park@brown.edu>2024-06-06 13:14:41 -0400
commit2277349fc4d5460e94a7a6b705b56488c0efb184 (patch)
tree73dc5fc6f74da323b903a6e9f5be870ce0cef23b /src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
parent2f5757ffaebaec9d459404fec266295abeebd2b0 (diff)
working on creating ink strokes from pts
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 194c99c3d..d22b3569e 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1233,23 +1233,26 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
@action
createDrawing = (e: PointerEvent, doubleTap?: boolean) => {
SmartDrawHandler.Instance.displaySmartDrawHandler(e.pageX, e.pageY);
- if (SmartDrawHandler.Instance.coords) {
- // const coords: InkData = SmartDrawHandler.Instance.coords;
- // const inkField = new InkField(coords);
- // const points = coords.map(p => intersect.inkView.ComponentView?.ptToScreen?.({ X: p.x, Y: p.y }) ?? { X: 0, Y: 0 })], [] as PointData[]);
- // const bounds = InkField.getBounds(points);
- // const B = this.screenToFreeformContentsXf.transformBounds(bounds.left, bounds.top, bounds.width, bounds.height);
- // const inkWidth = ActiveInkWidth() * this.ScreenToLocalBoxXf().Scale;
- // return Docs.Create.InkDocument(
- // points,
- // { title: 'stroke',
- // x: B.x - inkWidth / 2,
- // y: B.y - inkWidth / 2,
- // _width: B.width + inkWidth,
- // _height: B.height + inkWidth,
- // stroke_showLabel: BoolCast(Doc.UserDoc().activeInkHideTextLabels)}, // prettier-ignore
- // inkWidth
- // );
+ if (SmartDrawHandler.Instance.strokes.length > 0) {
+ const strokeList: InkData[] = SmartDrawHandler.Instance.strokes;
+ strokeList.forEach(coords => {
+ // const stroke = new InkField(coords);
+ // const points = coords.map(p => intersect.inkView.ComponentView?.ptToScreen?.({ X: p.X, Y: p.Y }) ?? { X: 0, Y: 0 }), [] as PointData[]);
+ const bounds = InkField.getBounds(coords);
+ const B = this.screenToFreeformContentsXf.transformBounds(bounds.left, bounds.top, bounds.width, bounds.height);
+ const inkWidth = ActiveInkWidth() * this.ScreenToLocalBoxXf().Scale;
+ const inkDoc = Docs.Create.InkDocument(
+ coords,
+ { title: 'stroke',
+ x: B.x - inkWidth / 2,
+ y: B.y - inkWidth / 2,
+ _width: B.width + inkWidth,
+ _height: B.height + inkWidth,
+ stroke_showLabel: BoolCast(Doc.UserDoc().activeInkHideTextLabels)}, // prettier-ignore
+ inkWidth
+ );
+ this.addDocument(inkDoc);
+ });
}
};