Skip to content

Commit

Permalink
fix: extend the list of attributes that can be overriden to `'x', 'y'…
Browse files Browse the repository at this point in the history
…, 'rx', 'ry', 'r', 'cx', 'cy'`
  • Loading branch information
stefan-lacatus committed Sep 5, 2023
1 parent 568ac3d commit a024bd2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/svgRenderer/svgRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ export interface SvgOverride {
[override: string]: any;
}

/**
* List of svg attributes that the renderer will override
*/
const SVG_ATTRIBUTES_TO_OVERRIDE = ['x', 'y', 'rx', 'ry', 'r', 'cx', 'cy'];

export class SvgElement {
container: JQuery;

Expand Down Expand Up @@ -368,7 +373,7 @@ export class SvgElement {
element.innerHTML = override[attrOverride];
} else if (
// X and Y are attributes on the element itself, not style elements
['x', 'y'].includes(attrOverride) &&
SVG_ATTRIBUTES_TO_OVERRIDE.includes(attrOverride) &&
override[attrOverride] != undefined
) {
element.setAttribute(attrOverride, override[attrOverride]);
Expand Down

0 comments on commit a024bd2

Please sign in to comment.