diff options
| author | bob <bcz@cs.brown.edu> | 2019-04-01 10:03:06 -0400 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2019-04-01 10:03:06 -0400 |
| commit | 5940a2dce5b45382521cd20b4770732dcbc3e732 (patch) | |
| tree | 75c62648e85a9c6a7840ff2a527a9063d0b4526d /src/client/views/InkingStroke.tsx | |
| parent | 5b348089bdc33e1e3b8e78ce51925b40793cb2cd (diff) | |
fixed inking problem - blinking cursors don't play nicely with ink
Diffstat (limited to 'src/client/views/InkingStroke.tsx')
| -rw-r--r-- | src/client/views/InkingStroke.tsx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx index 87b5c43d8..52111c711 100644 --- a/src/client/views/InkingStroke.tsx +++ b/src/client/views/InkingStroke.tsx @@ -21,21 +21,14 @@ export class InkingStroke extends React.Component<StrokeProps> { @observable private _strokeColor: string = this.props.color; @observable private _strokeWidth: string = this.props.width; - deleteStroke = (e: React.MouseEvent): void => { + deleteStroke = (e: React.PointerEvent): void => { if (InkingControl.Instance.selectedTool === InkTool.Eraser && e.buttons === 1) { this.props.deleteCallback(this.props.id); } } parseData = (line: Array<{ x: number, y: number }>): string => { - if (line.length === 0) { - return ""; - } - const pathData = "M " + - line.map(p => { - return p.x + " " + p.y; - }).join(" L "); - return pathData; + return !line.length ? "" : "M " + line.map(p => p.x + " " + p.y).join(" L "); } createStyle() { @@ -57,8 +50,8 @@ export class InkingStroke extends React.Component<StrokeProps> { return ( <path className={(this._strokeTool === InkTool.Highlighter) ? "highlight" : ""} - d={pathData} style={pathStyle} strokeLinejoin="round" strokeLinecap="round" - onMouseOver={this.deleteStroke} onMouseDown={this.deleteStroke} /> + d={pathData} style={{ ...pathStyle, pointerEvents: "all" }} strokeLinejoin="round" strokeLinecap="round" + onPointerOver={this.deleteStroke} onPointerDown={this.deleteStroke} /> ) } }
\ No newline at end of file |
