correct blur on copied and pasted elements, correct dasharray attribute, fixed error with strokes

master
Mark MacKay 2022-08-19 17:24:03 -04:00
parent 1e029fa536
commit 77708c595c
3 changed files with 16 additions and 7 deletions

View File

@ -78,7 +78,7 @@ MD.PaintBox = function(container, type){
const elem = selectedElems[0]; const elem = selectedElems[0];
// fill or stroke // fill or stroke
var url = elem.getAttribute(type); var url = elem.getAttribute(type);
if (url.includes("(")) { if (url && url.includes("(")) {
url = url.split("(")[1].split(")")[0]; url = url.split("(")[1].split(")")[0];
} }
// not a gradient // not a gradient

View File

@ -182,6 +182,17 @@ MD.Panel = function(){
if (elem !== null) { if (elem !== null) {
$("#stroke_panel").show(); $("#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 elname = elem.nodeName;
var angle = svgCanvas.getRotationAngle(elem); var angle = svgCanvas.getRotationAngle(elem);
$('#angle').val(Math.round(angle)); $('#angle').val(Math.round(angle));

View File

@ -7213,15 +7213,13 @@ this.setPaintOpacity = function(type, val, preventUndo) {
// elem - The element to check the blur value for // elem - The element to check the blur value for
this.getBlur = function(elem) { this.getBlur = function(elem) {
var val = 0; var val = 0;
// var elem = selectedElements[0];
if(elem) { if(elem) {
var filter_url = elem.getAttribute('filter'); var filter_url = elem.getAttribute('filter');
if(filter_url) { if(filter_url) {
var blur = getElem(elem.id + '_blur'); const selector = filter_url.split("url(#")[1].slice(0, -1);
if(blur) { var blur = getElem(selector);
val = blur.firstChild.getAttribute('stdDeviation'); if (blur) val = blur.firstChild.getAttribute('stdDeviation');
}
} }
} }
return val; return val;