aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-07-22 09:29:18 -0400
committerbobzel <zzzman@gmail.com>2022-07-22 09:29:18 -0400
commitea95bd9719623117fdf73a290633ae20839976f0 (patch)
tree722ef334fdbaf2f0958c2029f13658c2e03301cf
parent1a9f46e50551b618c7555e8e15e6d8e1394b0fe1 (diff)
changed ink width to be scaled by document scale to make it look like ink stroke is the same regardless of the native width of the document being drawn on.
-rw-r--r--src/client/views/InkingStroke.tsx10
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx25
2 files changed, 23 insertions, 12 deletions
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx
index 35d89d2b1..dace9716a 100644
--- a/src/client/views/InkingStroke.tsx
+++ b/src/client/views/InkingStroke.tsx
@@ -25,25 +25,25 @@ import { action, IReactionDisposer, observable, reaction } from "mobx";
import { observer } from "mobx-react";
import { Doc, WidthSym } from "../../fields/Doc";
import { InkData, InkField, InkTool } from "../../fields/InkField";
-import { BoolCast, Cast, NumCast, RTFCast, StrCast } from "../../fields/Types";
+import { Cast, NumCast, RTFCast, StrCast } from "../../fields/Types";
import { TraceMobx } from "../../fields/util";
-import { emptyFunction, OmitKeys, returnFalse, setupMoveUpEvents } from "../../Utils";
+import { OmitKeys, returnFalse, setupMoveUpEvents } from "../../Utils";
import { CognitiveServices } from "../cognitive_services/CognitiveServices";
import { InteractionUtils } from "../util/InteractionUtils";
import { SnappingManager } from "../util/SnappingManager";
import { Transform } from "../util/Transform";
import { UndoManager } from "../util/UndoManager";
import { ContextMenu } from "./ContextMenu";
-import { DocComponent, ViewBoxBaseComponent } from "./DocComponent";
+import { ViewBoxBaseComponent } from "./DocComponent";
import { Colors } from "./global/globalEnums";
import { InkControlPtHandles, InkEndPtHandles } from "./InkControlPtHandles";
-import "./InkStroke.scss";
import { InkStrokeProperties } from "./InkStrokeProperties";
import { InkTangentHandles } from "./InkTangentHandles";
+import { DocComponentView } from "./nodes/DocumentView";
import { FieldView, FieldViewProps } from "./nodes/FieldView";
import { FormattedTextBox } from "./nodes/formattedText/FormattedTextBox";
+import "./InkStroke.scss";
import Color = require("color");
-import { DocComponentView } from "./nodes/DocumentView";
@observer
export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index d9de5002b..5d7a12122 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -570,13 +570,24 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
case GestureUtils.Gestures.Stroke:
const points = ge.points;
const B = this.getTransform().transformBounds(ge.bounds.left, ge.bounds.top, ge.bounds.width, ge.bounds.height);
- const inkDoc = Docs.Create.InkDocument(ActiveInkColor(), Doc.ActiveTool, ActiveInkWidth(), ActiveInkBezierApprox(), ActiveFillColor(), ActiveArrowStart(), ActiveArrowEnd(), ActiveDash(), points, {
- title: 'ink stroke',
- x: B.x - ActiveInkWidth() / 2,
- y: B.y - ActiveInkWidth() / 2,
- _width: B.width + ActiveInkWidth(),
- _height: B.height + ActiveInkWidth(),
- });
+ const inkDoc = Docs.Create.InkDocument(
+ ActiveInkColor(),
+ Doc.ActiveTool,
+ ActiveInkWidth() * this.props.ScreenToLocalTransform().Scale,
+ ActiveInkBezierApprox(),
+ ActiveFillColor(),
+ ActiveArrowStart(),
+ ActiveArrowEnd(),
+ ActiveDash(),
+ points,
+ {
+ title: 'ink stroke',
+ x: B.x - ActiveInkWidth() / 2,
+ y: B.y - ActiveInkWidth() / 2,
+ _width: B.width + ActiveInkWidth() * this.props.ScreenToLocalTransform().Scale,
+ _height: B.height + ActiveInkWidth() * this.props.ScreenToLocalTransform().Scale,
+ }
+ );
if (Doc.ActiveTool === InkTool.Write) {
this.unprocessedDocs.push(inkDoc);
CollectionFreeFormView.collectionsWithUnprocessedInk.add(this);