diff --git a/src/js/PaintBox.js b/src/js/PaintBox.js index 1386020..dd99586 100644 --- a/src/js/PaintBox.js +++ b/src/js/PaintBox.js @@ -78,7 +78,7 @@ MD.PaintBox = function(container, type){ const elem = selectedElems[0]; // fill or stroke var url = elem.getAttribute(type); - if (url.includes("(")) { + if (url && url.includes("(")) { url = url.split("(")[1].split(")")[0]; } // not a gradient diff --git a/src/js/Panel.js b/src/js/Panel.js index 2373da3..aa48f2b 100644 --- a/src/js/Panel.js +++ b/src/js/Panel.js @@ -182,6 +182,17 @@ MD.Panel = function(){ if (elem !== null) { $("#stroke_panel").show(); + $('#stroke_width').val(elem.getAttribute("stroke-width") || 0); + // stroke style + const strokeStyle = elem.getAttribute("stroke-dasharray") || "none"; + const strokeStyles = { + "none": "—", + "2,2": "...", + "5,5": "- -", + "5,2,2,2": "-·-", + "5,2,2,2,2,2": "-··-" + }; + $("#stroke_style_label").html(strokeStyles[strokeStyle] || "—"); var elname = elem.nodeName; var angle = svgCanvas.getRotationAngle(elem); $('#angle').val(Math.round(angle)); diff --git a/src/js/svgcanvas.js b/src/js/svgcanvas.js index 794e069..3513703 100644 --- a/src/js/svgcanvas.js +++ b/src/js/svgcanvas.js @@ -7213,15 +7213,13 @@ this.setPaintOpacity = function(type, val, preventUndo) { // elem - The element to check the blur value for this.getBlur = function(elem) { var val = 0; -// var elem = selectedElements[0]; - + if(elem) { var filter_url = elem.getAttribute('filter'); if(filter_url) { - var blur = getElem(elem.id + '_blur'); - if(blur) { - val = blur.firstChild.getAttribute('stdDeviation'); - } + const selector = filter_url.split("url(#")[1].slice(0, -1); + var blur = getElem(selector); + if (blur) val = blur.firstChild.getAttribute('stdDeviation'); } } return val;