Skip to content

Commit 260c27d

Browse files
committed
brush rounded painting
1 parent 92e2e32 commit 260c27d

2 files changed

Lines changed: 5 additions & 21 deletions

File tree

css/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@
262262
width: 55px;
263263
padding: 0 0 0 2px;
264264
line-height: 23px;
265+
height: 23px;
265266
}
266267

267268
.ptro-wrapper .ptro-color-alpha-label,

js/primitive.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class PrimitiveTool {
2828
this.ctx.strokeStyle = this.main.colorWidgetState.line.alphaColor;
2929
this.ctx.fillStyle = this.main.colorWidgetState.fill.alphaColor;
3030
const scale = this.main.getScale();
31-
31+
this.ctx.lineCap = "round";
3232
if (mainClass === 'ptro-crp-el' || mainClass === 'ptro-zoomer') {
3333
this.tmpData = this.ctx.getImageData(0, 0, this.main.size.w, this.main.size.h);
3434
if (this.type === 'brush') {
@@ -58,25 +58,6 @@ export class PrimitiveTool {
5858

5959
drawBrushPath () {
6060
const smPoints = this.points;
61-
this.ctx.beginPath();
62-
63-
this.ctx.lineWidth = 0;
64-
this.ctx.fillStyle = this.main.colorWidgetState.line.alphaColor;
65-
66-
this.ctx.ellipse(
67-
this.points[0].x, this.points[0].y,
68-
this.lineWidth / 2, this.lineWidth / 2,
69-
0, 2 * Math.PI, false);
70-
71-
this.ctx.ellipse(
72-
this.points[this.points.length - 1].x,
73-
this.points[this.points.length - 1].y,
74-
this.lineWidth / 2, this.lineWidth / 2,
75-
0, 2 * Math.PI, false);
76-
77-
this.ctx.fill();
78-
this.ctx.closePath();
79-
8061

8162
this.ctx.beginPath();
8263
this.ctx.lineWidth = this.lineWidth;
@@ -92,8 +73,10 @@ export class PrimitiveTool {
9273
if (last) {
9374
this.ctx.moveTo(last.x, last.y);
9475
}
95-
this.ctx.closePath();
76+
9677
this.ctx.stroke();
78+
79+
this.ctx.closePath();
9780
}
9881

9982
handleMouseMove(event) {

0 commit comments

Comments
 (0)