aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkingStroke.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-05-14 12:03:40 -0400
committerbobzel <zzzman@gmail.com>2023-05-14 12:03:40 -0400
commit42afc0250de658fc3e924864bfae5afb4edec335 (patch)
treed61bbc43d95cb6e1d6fa5c997102d505adc09af5 /src/client/views/InkingStroke.tsx
parent0849fbd97c61688d51e5fea6cf8edc47989df5de (diff)
major overhaul of field naming conventions.
Diffstat (limited to 'src/client/views/InkingStroke.tsx')
-rw-r--r--src/client/views/InkingStroke.tsx30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx
index 2fd6cc4d6..14c5dc58d 100644
--- a/src/client/views/InkingStroke.tsx
+++ b/src/client/views/InkingStroke.tsx
@@ -6,7 +6,7 @@
point 1, tangent pt 1, tangent pt 2, point 2, point 3, tangent pt 3, ... (Note that segment endpoints are duplicated ie Point2 = Point 3)
brokenIndices - an array of indexes into the data field where the incoming and outgoing tangents are not constrained to be equal
text - a text field that will be centered within a closed ink stroke
- isInkMask - a flag that makes the ink stroke render as a mask over its collection where the stroke itself is mixBlendMode multiplied by
+ stroke_isInkMask - a flag that makes the ink stroke render as a mask over its collection where the stroke itself is mixBlendMode multiplied by
the underlying collection content, and everything outside the stroke is covered by a semi-opaque dark gray mask.
The coordinates of the ink data need to be mapped to the screen since ink points are not changed when the DocumentView is translated or scaled.
@@ -134,7 +134,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
* dimmed by a semi-opaque overlay mask.
*/
public static toggleMask = action((inkDoc: Doc) => {
- inkDoc.isInkMask = !inkDoc.isInkMask;
+ inkDoc.stroke_isInkMask = !inkDoc.stroke_isInkMask;
});
@observable controlUndo: UndoManager.Batch | undefined;
/**
@@ -241,7 +241,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
*/
inkScaledData = () => {
const inkData = Cast(this.dataDoc[this.fieldKey], InkField)?.inkData ?? [];
- const inkStrokeWidth = NumCast(this.rootDoc.strokeWidth, 1);
+ const inkStrokeWidth = NumCast(this.rootDoc.stroke_width, 1);
const inkTop = Math.min(...inkData.map(p => p.Y)) - inkStrokeWidth / 2;
const inkBottom = Math.max(...inkData.map(p => p.Y)) + inkStrokeWidth / 2;
const inkLeft = Math.min(...inkData.map(p => p.X)) - inkStrokeWidth / 2;
@@ -310,8 +310,8 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
.map(p => ({ X: p[0], Y: p[1] }));
const screenHdlPts = screenPts;
- const startMarker = StrCast(this.layoutDoc.strokeStartMarker);
- const endMarker = StrCast(this.layoutDoc.strokeEndMarker);
+ const startMarker = StrCast(this.layoutDoc.stroke_startMarker);
+ const endMarker = StrCast(this.layoutDoc.stroke_endMarker);
const markerScale = NumCast(this.layoutDoc.strokeMarkerScale);
return SnappingManager.GetIsDragging() ? null : !InkStrokeProperties.Instance._controlButton ? (
!this.props.isSelected() || InkingStroke.IsClosed(inkData) ? null : (
@@ -330,12 +330,12 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
screenSpaceCenterlineStrokeWidth,
StrCast(inkDoc.strokeLineJoin),
StrCast(this.layoutDoc.strokeLineCap),
- StrCast(inkDoc.strokeBezier),
+ StrCast(inkDoc.stroke_bezier),
'none',
startMarker,
endMarker,
markerScale * Math.min(screenSpaceCenterlineStrokeWidth, screenInkWidth[0] / screenSpaceCenterlineStrokeWidth),
- StrCast(inkDoc.strokeDash),
+ StrCast(inkDoc.stroke_dash),
1,
1,
'',
@@ -355,11 +355,11 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
TraceMobx();
const { inkData, inkStrokeWidth, inkLeft, inkTop, inkScaleX, inkScaleY, inkWidth, inkHeight } = this.inkScaledData();
- const startMarker = StrCast(this.layoutDoc.strokeStartMarker);
- const endMarker = StrCast(this.layoutDoc.strokeEndMarker);
+ const startMarker = StrCast(this.layoutDoc.stroke_startMarker);
+ const endMarker = StrCast(this.layoutDoc.stroke_endMarker);
const markerScale = NumCast(this.layoutDoc.strokeMarkerScale, 1);
const closed = InkingStroke.IsClosed(inkData);
- const isInkMask = BoolCast(this.layoutDoc.isInkMask);
+ const isInkMask = BoolCast(this.layoutDoc.stroke_isInkMask);
const fillColor = isInkMask ? DashColor(StrCast(this.layoutDoc.fillColor, 'transparent')).blacken(0).rgb().toString() : this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.FillColor) ?? 'transparent';
const strokeColor = !closed && fillColor && fillColor !== 'transparent' ? fillColor : this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.Color) ?? StrCast(this.layoutDoc.color);
@@ -381,12 +381,12 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
inkStrokeWidth,
StrCast(this.layoutDoc.strokeLineJoin),
StrCast(this.layoutDoc.strokeLineCap),
- StrCast(this.layoutDoc.strokeBezier),
+ StrCast(this.layoutDoc.stroke_bezier),
!closed ? 'none' : fillColor === 'transparent' ? 'none' : fillColor,
startMarker,
endMarker,
markerScale,
- StrCast(this.layoutDoc.strokeDash),
+ StrCast(this.layoutDoc.stroke_dash),
inkScaleX,
inkScaleY,
'',
@@ -408,7 +408,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
inkStrokeWidth + (fillColor ? (closed ? 2 : (highlightIndex ?? 0) + 2) : 2),
StrCast(this.layoutDoc.strokeLineJoin),
StrCast(this.layoutDoc.strokeLineCap),
- StrCast(this.layoutDoc.strokeBezier),
+ StrCast(this.layoutDoc.stroke_bezier),
!closed ? 'none' : !isInkMask && (fillColor === 'transparent' || suppressFill) ? 'none' : fillColor,
'',
'',
@@ -444,7 +444,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
<svg
className="inkStroke"
style={{
- transform: this.props.Document.isInkMask ? `rotate(-${NumCast(this.props.CollectionFreeFormDocumentView?.().Rot)}deg) translate(${InkingStroke.MaskDim / 2}px, ${InkingStroke.MaskDim / 2}px)` : undefined,
+ transform: isInkMask ? `rotate(-${NumCast(this.props.CollectionFreeFormDocumentView?.().Rot)}deg) translate(${InkingStroke.MaskDim / 2}px, ${InkingStroke.MaskDim / 2}px)` : undefined,
// mixBlendMode: this.layoutDoc.tool === InkTool.Highlighter ? 'multiply' : 'unset',
cursor: this.props.isSelected() ? 'default' : undefined,
}}
@@ -469,7 +469,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() {
setContentView={this.setSubContentView} // this makes the inkingStroke the "dominant" component - ie, it will show the inking UI when selected (not text)
yPadding={10}
xPadding={10}
- fieldKey={'text'}
+ fieldKey="text"
fontSize={fsize}
dontRegisterView={true}
noSidebar={true}