diff options
author | bobzel <zzzman@gmail.com> | 2022-11-11 00:15:46 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-11-11 00:15:46 -0500 |
commit | 493faff1b3c84d8f31796e8059a3eaa5bd80fbd6 (patch) | |
tree | 393ae123c980b63095638ab05e660d3ba49ba5d0 /src/client/views/InkingStroke.tsx | |
parent | e7995c366381e5f813ddcb3babc90c8b51e407b6 (diff) |
fixed converting strokes to inkMasks. cleaned up rendering inkStrkes w/ w/o closed/borders. fixed highlighting strokes not to show boundingbox.
Diffstat (limited to 'src/client/views/InkingStroke.tsx')
-rw-r--r-- | src/client/views/InkingStroke.tsx | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx index 8fbe6d7c1..1e18e1dff 100644 --- a/src/client/views/InkingStroke.tsx +++ b/src/client/views/InkingStroke.tsx @@ -390,12 +390,9 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() { 1.0, false ); - const highlightIndex = /*BoolCast(this.props.Document.isLinkButton) && */ Doc.isBrushedHighlightedDegree(this.props.Document); // bcz: Argh!! need to identify a tree view doc better than a LayoutTemlatString - const highlightColor = isInkMask - ? 'transparent' - : !highlightIndex - ? StrCast(this.layoutDoc.strokeOutlineColor, !closed && fillColor && fillColor !== 'transparent' ? StrCast(this.layoutDoc.color, 'transparent') : 'transparent') - : ['transparent', 'rgb(68, 118, 247)', 'rgb(68, 118, 247)', 'yellow', 'magenta', 'cyan', 'orange'][highlightIndex]; + const highlight = this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.Highlighting); + const highlightIndex = highlight?.highlightIndex; + const highlightColor = highlight?.highlightIndex ? highlight?.highlightColor : StrCast(this.layoutDoc.strokeOutlineColor, !closed && fillColor && fillColor !== 'transparent' ? StrCast(this.layoutDoc.color, 'transparent') : 'transparent'); // Invisible polygonal line that enables the ink to be selected by the user. const clickableLine = (downHdlr?: (e: React.PointerEvent) => void, suppressFill: boolean = false) => InteractionUtils.CreatePolyline( @@ -404,7 +401,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() { inkTop, highlightColor, inkStrokeWidth, - Math.max(5, fillColor && closed && highlightIndex ? highlightIndex / 2 : inkStrokeWidth + (fillColor ? (closed ? 0 : highlightIndex + 2) : 0)), + inkStrokeWidth + (fillColor ? (closed ? 2 : (highlightIndex ?? 0) + 2) : 2), StrCast(this.layoutDoc.strokeLineJoin), StrCast(this.layoutDoc.strokeLineCap), StrCast(this.layoutDoc.strokeBezier), @@ -446,9 +443,9 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() { // mixBlendMode: this.layoutDoc.tool === InkTool.Highlighter ? 'multiply' : 'unset', cursor: this.props.isSelected() ? 'default' : undefined, }} - {...(!closed ? interactions : {})}> - {closed ? inkLine : clickableLine(this.onPointerDown)} - {closed ? clickableLine(this.onPointerDown) : inkLine} + {...interactions}> + {clickableLine(this.onPointerDown)} + {inkLine} </svg> {!closed || (!RTFCast(this.rootDoc.text)?.Text && !this.props.isSelected()) ? null : ( <div @@ -475,19 +472,6 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps>() { /> </div> )} - {!closed ? null : ( - <svg - className="inkStroke" - style={{ - transform: this.props.Document.isInkMask ? `translate(${InkingStroke.MaskDim / 2}px, ${InkingStroke.MaskDim / 2}px)` : undefined, - mixBlendMode: 'unset', - cursor: this.props.isSelected() ? 'default' : undefined, - position: 'absolute', - }} - {...interactions}> - {clickableLine(this.onPointerDown, true)} - </svg> - )} </div> ); } |