javascript - part of raphael svg path is stuck in place -
i'm testing vector (of hand) using raphael.js , under impression "m" parameter indicates start drawing path, in example: http://jsfiddle.net/7qa43/1/ when changed parameter's of m (from 361,243 100,100) seems part of pinky how "anchored" original position.
i've scanned through svg path data may causing this, can;t find it.
could part of path off?
in svg path there 2 flavors of path commands: absolute , relative.
- absolute path commands noted uppercase letter , indicate coordinates specified irrespective of previous point.
- relative path commands noted lowercase letter , indicate coordinates specified relative previous path command's location.
all path commands relative except last curveto command:
"...44-1.436,3.662-2.155c357.073,245.799,359.609,244.566,361.839,243.057z"
from specs:
draws cubic bézier curve current point (x,y) using (x1,y1) control point @ beginning of curve , (x2,y2) control point @ end of curve. c (uppercase) indicates absolute coordinates follow; c (lowercase) indicates relative coordinates follow. multiple sets of coordinates may specified draw polybézier. @ end of command, new current point becomes final (x,y) coordinate pair used in polybézier.
the simplest fix remove command path little apparent difference:
fixed via deletion: http://jsfiddle.net/7qa43/2/
alternatively, don't use first moveto command adjust path's location. keep path , transform() new location:
path_a.transform('t-200,-154'); fixed via transform: http://jsfiddle.net/7qa43/5/
fixing problem finding last coordinate of command before offending curveto , changing parameters use relative values left exercise reader.
Comments
Post a Comment