Adding center property to bounding box
This commit is contained in:
parent
4acd8fe47d
commit
2dd068a94c
File diff suppressed because one or more lines are too long
|
|
@ -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;
|
||||
|
|
|
|||
12
raphael.js
12
raphael.js
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue