Adding center property to bounding box

This commit is contained in:
Tomas Alabes 2013-03-12 20:49:30 -03:00
parent 4acd8fe47d
commit 2dd068a94c
3 changed files with 24 additions and 7 deletions

7
raphael-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1573,6 +1573,8 @@
o y2: (number) y coordinate of the right bottom point of the box
o width: (number) width of the box
o height: (number) height of the box
o cx: (number) x coordinate of the center of the box
o cy: (number) y coordinate of the center of the box
o }
\*/
var pathDimensions = R.pathBBox = function (path) {
@ -1608,13 +1610,17 @@
ymin = mmin[apply](0, Y),
xmax = mmax[apply](0, X),
ymax = mmax[apply](0, Y),
bb = {
width = xmax - xmin,
height = ymax - ymin,
bb = {
x: xmin,
y: ymin,
x2: xmax,
y2: ymax,
width: xmax - xmin,
height: ymax - ymin
width: width,
height: height,
cx: xmin + width / 2,
cy: ymin + height / 2
};
pth.bbox = clone(bb);
return bb;

View File

@ -1953,6 +1953,8 @@
o y2: (number) y coordinate of the right bottom point of the box
o width: (number) width of the box
o height: (number) height of the box
o cx: (number) x coordinate of the center of the box
o cy: (number) y coordinate of the center of the box
o }
\*/
var pathDimensions = R.pathBBox = function (path) {
@ -1988,13 +1990,17 @@
ymin = mmin[apply](0, Y),
xmax = mmax[apply](0, X),
ymax = mmax[apply](0, Y),
bb = {
width = xmax - xmin,
height = ymax - ymin,
bb = {
x: xmin,
y: ymin,
x2: xmax,
y2: ymax,
width: xmax - xmin,
height: ymax - ymin
width: width,
height: height,
cx: xmin + width / 2,
cy: ymin + height / 2
};
pth.bbox = clone(bb);
return bb;