File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ const Canvas: React.FC = () => {
102
102
const g = this . graphics
103
103
g . clear ( )
104
104
. beginStroke ( props . strokeColor )
105
- . setStrokeStyle ( pathThickness )
105
+ . setStrokeStyle ( props ?. thickness ?? pathThickness )
106
106
. moveTo ( 0 , 0 )
107
107
. lineTo ( props . endX - props . x , props . endY - props . y )
108
108
} else if ( props . type === 'path' && props . points ) {
@@ -165,6 +165,11 @@ const Canvas: React.FC = () => {
165
165
g . clear ( )
166
166
167
167
const { x : startX , y : startY } = startPoint
168
+ let thickness = pathThickness
169
+
170
+ if ( [ 'line' , 'path' ] . includes ( shapeType ) && currentShape ?. graphics ?. _strokeStyle ?. width ) {
171
+ thickness = currentShape ?. graphics ?. _strokeStyle ?. width
172
+ }
168
173
169
174
switch ( shapeType ) {
170
175
case 'rectangle' :
@@ -178,10 +183,10 @@ const Canvas: React.FC = () => {
178
183
break
179
184
}
180
185
case 'line' :
181
- g . beginStroke ( pathColor . current ) . setStrokeStyle ( pathThickness ) . moveTo ( startX , startY ) . lineTo ( x , y )
186
+ g . beginStroke ( pathColor . current ) . setStrokeStyle ( thickness ) . moveTo ( startX , startY ) . lineTo ( x , y )
182
187
break
183
188
case 'path' : {
184
- const newPoints = g . beginStroke ( pathColor . current ) . setStrokeStyle ( pathThickness )
189
+ const newPoints = g . beginStroke ( pathColor . current ) . setStrokeStyle ( thickness )
185
190
186
191
if ( isEmpty ( pathPointsRef . current ) ) {
187
192
newPoints . moveTo ( startX , startY )
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ const getUpdatedShapeData = (shape: Shape) => {
15
15
points : shape . points ? [ ...shape . points ] : undefined ,
16
16
endX : shape . endX ,
17
17
endY : shape . endY ,
18
+ thickness : shape . thickness ,
18
19
}
19
20
20
21
switch ( shape . type ) {
You can’t perform that action at this time.
0 commit comments