Skip to content

Commit f26f3e7

Browse files
committed
embiem#155 remove catenary ui when lazy radius 0
1 parent 987d9fb commit f26f3e7

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

demo/src/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ class Demo extends Component {
245245
</a>
246246
.
247247
</p>
248+
<h2>Additional Func</h2>
249+
<h3>0 lazyRadius case: no catenary ui</h3>
250+
<CanvasDraw hideGrid lazyRadius={0} />
251+
<h3>clear mode</h3>
252+
<CanvasDraw hideGrid lazyRadius={0} />
248253
</div>
249254
);
250255
}

src/index.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -720,10 +720,12 @@ export default class CanvasDraw extends PureComponent {
720720
ctx.fill();
721721

722722
// Draw mouse point (the one directly at the cursor)
723-
ctx.beginPath();
724-
ctx.fillStyle = this.props.catenaryColor;
725-
ctx.arc(pointer.x, pointer.y, 4, 0, Math.PI * 2, true);
726-
ctx.fill();
723+
if (this.props.lazyRadius > 0) {
724+
ctx.beginPath();
725+
ctx.fillStyle = this.props.catenaryColor;
726+
ctx.arc(pointer.x, pointer.y, 4, 0, Math.PI * 2, true);
727+
ctx.fill();
728+
}
727729

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

744746
// Draw brush point (the one in the middle of the brush preview)
745-
ctx.beginPath();
746-
ctx.fillStyle = this.props.catenaryColor;
747-
ctx.arc(brush.x, brush.y, 2, 0, Math.PI * 2, true);
748-
ctx.fill();
747+
if (this.props.lazyRadius > 0) {
748+
ctx.beginPath();
749+
ctx.fillStyle = this.props.catenaryColor;
750+
ctx.arc(brush.x, brush.y, 2, 0, Math.PI * 2, true);
751+
ctx.fill();
752+
}
749753
};
750754
}

0 commit comments

Comments
 (0)