#46 paintbox and current element color set issue fixed

This commit is contained in:
Agriya Dev5
2021-02-05 19:31:12 +05:30
parent 2a59e75cab
commit 166b602887
2 changed files with 6 additions and 7 deletions

View File

@@ -1,4 +1,3 @@
/* globals $ */
import {jGraduate} from './jgraduate/jQuery.jGraduate.js';
/**
*
@@ -21,7 +20,7 @@ class PaintBox {
let docElem = svgdocbox.documentElement;
docElem = document.importNode(docElem, true);
container.append(docElem);
container.appendChild(docElem);
this.rect = docElem.firstElementChild;
this.defs = docElem.getElementsByTagName('defs')[0];
@@ -49,7 +48,7 @@ class PaintBox {
case 'radialGradient': {
this.grad.remove();
this.grad = paint[ptype];
this.defs.append(this.grad);
this.defs.appendChild(this.grad);
const id = this.grad.id = 'gradbox_' + this.type;
fillAttr = 'url(#' + id + ')';
break;
@@ -71,7 +70,7 @@ class PaintBox {
const opts = {alpha: opac};
if (color.startsWith('url(#')) {
let refElem = svgCanvas.getRefElem(color);
refElem = (refElem) ? refElem.cloneNode(true) : $('#' + type + '_color defs *')[0];
refElem = (refElem) ? refElem.cloneNode(true) : document.querySelectorAll('#' + type + '_color defs *')[0];
opts[refElem.tagName] = refElem;
} else if (color.startsWith('#')) {
opts.solidColor = color.substr(1);