@@ -152,7 +152,10 @@ function drawShape({
152
152
ctx . lineWidth = strokeWidth ;
153
153
if ( shape instanceof Rectangle ) {
154
154
ctx . fillRect ( shape . left , shape . top , shape . width , shape . height ) ;
155
- ctx . strokeRect ( shape . left , shape . top , shape . width , shape . height ) ;
155
+ // ctx stroke methods will draw a visible stroke, even if the width is 0
156
+ if ( strokeWidth ) {
157
+ ctx . strokeRect ( shape . left , shape . top , shape . width , shape . height ) ;
158
+ }
156
159
} else if ( shape instanceof Ellipse ) {
157
160
const adjustedLeft = shape . left + shape . rx ;
158
161
const adjustedTop = shape . top + shape . ry ;
@@ -169,7 +172,9 @@ function drawShape({
169
172
) ;
170
173
ctx . closePath ( ) ;
171
174
ctx . fill ( ) ;
172
- ctx . stroke ( ) ;
175
+ if ( strokeWidth ) {
176
+ ctx . stroke ( ) ;
177
+ }
173
178
} else if ( shape instanceof Polygon ) {
174
179
const offset = getPolygonOffset ( shape ) ;
175
180
ctx . save ( ) ;
@@ -181,7 +186,9 @@ function drawShape({
181
186
}
182
187
ctx . closePath ( ) ;
183
188
ctx . fill ( ) ;
184
- ctx . stroke ( ) ;
189
+ if ( strokeWidth ) {
190
+ ctx . stroke ( ) ;
191
+ }
185
192
ctx . restore ( ) ;
186
193
} else if ( shape instanceof Text ) {
187
194
ctx . save ( ) ;
@@ -267,13 +274,13 @@ function getShapeProperties(): ShapeProperties {
267
274
? inActiveShapeColor
268
275
: "#ffeba2" ,
269
276
activeBorder : {
270
- width : activeShapeBorderWidth ? activeShapeBorderWidth : 1 ,
277
+ width : ! isNaN ( activeShapeBorderWidth ) ? activeShapeBorderWidth : 1 ,
271
278
color : activeShapeBorderColor
272
279
? activeShapeBorderColor
273
280
: "#212121" ,
274
281
} ,
275
282
inActiveBorder : {
276
- width : inActiveShapeBorderWidth ? inActiveShapeBorderWidth : 1 ,
283
+ width : ! isNaN ( inActiveShapeBorderWidth ) ? inActiveShapeBorderWidth : 1 ,
277
284
color : inActiveShapeBorderColor
278
285
? inActiveShapeBorderColor
279
286
: "#212121" ,
0 commit comments