fix(svgcanvas): Handle 'none' stroke color in SVG elements (#1084)

This update modifies the stroke color handling in both the SvgCanvas and ext-connector modules. When the stroke color is set to 'none', it now correctly assigns an empty string or 'none' instead of a hex value, ensuring proper rendering of SVG elements without strokes.
This commit is contained in:
shanyue
2026-03-16 23:08:34 +08:00
committed by GitHub
parent 173dd2607a
commit 7c6085e7b9
2 changed files with 7 additions and 2 deletions

View File

@@ -201,7 +201,9 @@ class SvgCanvas {
this.curConfig.initFill.color, this.curConfig.initFill.color,
fill_paint: null, fill_paint: null,
fill_opacity: this.curConfig.initFill.opacity, fill_opacity: this.curConfig.initFill.opacity,
stroke: `#${this.curConfig.initStroke.color}`, stroke:
(this.curConfig.initStroke.color === 'none' ? '' : '#') +
this.curConfig.initStroke.color,
stroke_paint: null, stroke_paint: null,
stroke_opacity: this.curConfig.initStroke.opacity, stroke_opacity: this.curConfig.initStroke.opacity,
stroke_width: this.curConfig.initStroke.width, stroke_width: this.curConfig.initStroke.width,

View File

@@ -447,7 +447,10 @@ export default {
attr: { attr: {
id: 'conn_' + svgCanvas.getNextId(), id: 'conn_' + svgCanvas.getNextId(),
points: `${x},${y} ${x},${y} ${startX},${startY}`, points: `${x},${y} ${x},${y} ${startX},${startY}`,
stroke: `#${initStroke.color}`, stroke:
initStroke.color === 'none'
? 'none'
: `#${initStroke.color}`,
'stroke-width': 'stroke-width':
!startElem.stroke_width || startElem.stroke_width === 0 !startElem.stroke_width || startElem.stroke_width === 0
? initStroke.width ? initStroke.width