Revert "Use new canvas Path rect/SVG support."
Don't use the built-in SVG/rect parser, since this bypasses creating
coordinate / command properties which some Canvas users rely upon.
This reverts commit 57a2d21ddf
.
This commit is contained in:
parent
30c6428f7f
commit
51e2ddc8ba
2 changed files with 16 additions and 23 deletions
|
@ -480,7 +480,7 @@ var Map = {
|
|||
controller = Map.df_controller;
|
||||
elsif (typeof(controller) != 'hash')
|
||||
controller = Map.Controller.get(controller);
|
||||
|
||||
|
||||
if (controller == nil) {
|
||||
me.controller = nil;
|
||||
} else {
|
||||
|
@ -778,12 +778,6 @@ var Path = {
|
|||
me._last_coord = size(coords) - 1;
|
||||
return me;
|
||||
},
|
||||
setDataSVG: func(svgPath)
|
||||
{
|
||||
me.reset();
|
||||
me._node.setValues({'svg': svgPath});
|
||||
return me;
|
||||
},
|
||||
# Add a path segment
|
||||
addSegment: func(cmd, coords...)
|
||||
{
|
||||
|
@ -954,7 +948,7 @@ var Path = {
|
|||
},
|
||||
|
||||
setColor: func me.setStroke(_getColor(arg)),
|
||||
getColor: func me.getStroke(),
|
||||
getColor: func me.getStroke(),
|
||||
|
||||
setColorFill: func me.setFill(_getColor(arg)),
|
||||
getColorFill: func me.getColorFill(),
|
||||
|
|
|
@ -502,15 +502,13 @@ var parsesvg = func(group, path, options = nil)
|
|||
else if( name == "path" or name == "rect" )
|
||||
{
|
||||
pushElement('path', attr['id']);
|
||||
var p = stack[-1];
|
||||
|
||||
if( name == "rect" )
|
||||
{
|
||||
p.set('rect/left', evalCSSNum(attr['x']));
|
||||
p.set('rect/top', evalCSSNum(attr['y']));
|
||||
p.set('rect/width', evalCSSNum(attr['width']));
|
||||
p.set('rect/height', evalCSSNum(attr['height']));
|
||||
|
||||
var width = evalCSSNum(attr['width']);
|
||||
var height = evalCSSNum(attr['height']);
|
||||
var x = evalCSSNum(attr['x']);
|
||||
var y = evalCSSNum(attr['y']);
|
||||
var rx = attr['rx'];
|
||||
var ry = attr['ry'];
|
||||
|
||||
|
@ -519,14 +517,15 @@ var parsesvg = func(group, path, options = nil)
|
|||
else if( rx == nil )
|
||||
rx = ry;
|
||||
|
||||
if( rx != nil ) {
|
||||
p.set('border-radius[0]', rx);
|
||||
p.set('border-radius[1]', ry);
|
||||
}
|
||||
} else {
|
||||
p.setDataSVG(attr['d']);
|
||||
}
|
||||
var cfg = {};
|
||||
if( rx != nil )
|
||||
cfg["border-radius"] = [evalCSSNum(rx), evalCSSNum(ry)];
|
||||
|
||||
stack[-1].rect(x, y, width, height, cfg);
|
||||
}
|
||||
else
|
||||
parsePath(attr['d']);
|
||||
|
||||
var fillOpacity = style['fill-opacity'];
|
||||
if( fillOpacity != nil)
|
||||
stack[-1].set('fill', style['fill'] ~ sprintf("%02x", int(style['fill-opacity']*255)));
|
||||
|
@ -535,13 +534,13 @@ var parsesvg = func(group, path, options = nil)
|
|||
|
||||
var w = style['stroke-width'];
|
||||
stack[-1].setStrokeLineWidth( w != nil ? evalCSSNum(w) : 1 );
|
||||
|
||||
|
||||
var strokeOpacity = style['stroke-opacity'];
|
||||
if(strokeOpacity != nil)
|
||||
stack[-1].set('stroke', (style['stroke'] ~ sprintf("%02x", int(style['stroke-opacity']*255))));
|
||||
else
|
||||
stack[-1].set('stroke', style['stroke'] or "none");
|
||||
|
||||
|
||||
var linecap = style['stroke-linecap'];
|
||||
if( linecap != nil )
|
||||
stack[-1].setStrokeLineCap(style['stroke-linecap']);
|
||||
|
|
Loading…
Reference in a new issue