Skip to content

Commit

Permalink
embiem#155 remove catenary ui when lazy radius 0
Browse files Browse the repository at this point in the history
  • Loading branch information
lindychi committed Jul 21, 2022
1 parent 987d9fb commit f26f3e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ class Demo extends Component {
</a>
.
</p>
<h2>Additional Func</h2>
<h3>0 lazyRadius case: no catenary ui</h3>
<CanvasDraw hideGrid lazyRadius={0} />
<h3>clear mode</h3>
<CanvasDraw hideGrid lazyRadius={0} />
</div>
);
}
Expand Down
20 changes: 12 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,12 @@ export default class CanvasDraw extends PureComponent {
ctx.fill();

// Draw mouse point (the one directly at the cursor)
ctx.beginPath();
ctx.fillStyle = this.props.catenaryColor;
ctx.arc(pointer.x, pointer.y, 4, 0, Math.PI * 2, true);
ctx.fill();
if (this.props.lazyRadius > 0) {
ctx.beginPath();
ctx.fillStyle = this.props.catenaryColor;
ctx.arc(pointer.x, pointer.y, 4, 0, Math.PI * 2, true);
ctx.fill();
}

// Draw catenary
if (this.lazy.isEnabled()) {
Expand All @@ -742,9 +744,11 @@ export default class CanvasDraw extends PureComponent {
}

// Draw brush point (the one in the middle of the brush preview)
ctx.beginPath();
ctx.fillStyle = this.props.catenaryColor;
ctx.arc(brush.x, brush.y, 2, 0, Math.PI * 2, true);
ctx.fill();
if (this.props.lazyRadius > 0) {
ctx.beginPath();
ctx.fillStyle = this.props.catenaryColor;
ctx.arc(brush.x, brush.y, 2, 0, Math.PI * 2, true);
ctx.fill();
}
};
}

0 comments on commit f26f3e7

Please sign in to comment.