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 = () => {
102102 const g = this . graphics
103103 g . clear ( )
104104 . beginStroke ( props . strokeColor )
105- . setStrokeStyle ( pathThickness )
105+ . setStrokeStyle ( props ?. thickness ?? pathThickness )
106106 . moveTo ( 0 , 0 )
107107 . lineTo ( props . endX - props . x , props . endY - props . y )
108108 } else if ( props . type === 'path' && props . points ) {
@@ -165,6 +165,11 @@ const Canvas: React.FC = () => {
165165 g . clear ( )
166166
167167 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+ }
168173
169174 switch ( shapeType ) {
170175 case 'rectangle' :
@@ -178,10 +183,10 @@ const Canvas: React.FC = () => {
178183 break
179184 }
180185 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 )
182187 break
183188 case 'path' : {
184- const newPoints = g . beginStroke ( pathColor . current ) . setStrokeStyle ( pathThickness )
189+ const newPoints = g . beginStroke ( pathColor . current ) . setStrokeStyle ( thickness )
185190
186191 if ( isEmpty ( pathPointsRef . current ) ) {
187192 newPoints . moveTo ( startX , startY )
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ const getUpdatedShapeData = (shape: Shape) => {
1515 points : shape . points ? [ ...shape . points ] : undefined ,
1616 endX : shape . endX ,
1717 endY : shape . endY ,
18+ thickness : shape . thickness ,
1819 }
1920
2021 switch ( shape . type ) {
You can’t perform that action at this time.
0 commit comments