mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
- [SVG] Fix error when loading file.
This commit is contained in:
parent
a06e66c453
commit
271bc53343
@ -18,7 +18,12 @@ function SVGElement(svgObj = noone) constructor {
|
||||
stroke = struct_try_get(attr, "stroke", undefined);
|
||||
stroke_width = struct_try_get(attr, "stroke-width", undefined);
|
||||
|
||||
if(is_string(fill)) fill = color_from_rgb(string_replace_all(fill, "#", ""));
|
||||
if(is_string(stroke)) stroke = color_from_rgb(string_replace_all(stroke, "#", ""));
|
||||
|
||||
shapeAttr(attr);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static shapeAttr = function(attr) {}
|
||||
@ -39,8 +44,6 @@ function SVG(svgObj = noone) : SVGElement(svgObj) constructor {
|
||||
static mapX = function(px) { return lerp_invert(px, bbox[0], bbox[0] + bbox[2]) * width; }
|
||||
static mapY = function(py) { return lerp_invert(py, bbox[1], bbox[1] + bbox[3]) * height; }
|
||||
|
||||
static setAttr = function(attr) {}
|
||||
|
||||
static getSurface = function(scale = 1) { return surface_create(width * scale, height * scale); }
|
||||
|
||||
static draw = function(scale = 1) {
|
||||
|
@ -13,7 +13,7 @@ function svg_parse(xmlStr) {
|
||||
var ww = struct_try_get(attr, "width", 1);
|
||||
var hh = struct_try_get(attr, "height", 1);
|
||||
|
||||
var svg = new SVG();
|
||||
var svg = new SVG().setAttr(attr);
|
||||
svg.width = toNumber(string_digits(ww));
|
||||
svg.height = toNumber(string_digits(hh));
|
||||
|
||||
@ -25,12 +25,6 @@ function svg_parse(xmlStr) {
|
||||
svg.bbox = bbox;
|
||||
}
|
||||
|
||||
if(struct_has(attr, "fill")) {
|
||||
var _f = attr.fill;
|
||||
_f = string_replace_all(_f, "#", "");
|
||||
svg.fill = color_from_rgb(_f);
|
||||
}
|
||||
|
||||
if(struct_has(svg_object, "children")) {
|
||||
var _ind = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user