mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
SvgExporter: Some more work on determineAngle().
This commit is contained in:
parent
4c463eb1f1
commit
16de863aa5
1 changed files with 4 additions and 6 deletions
|
@ -119,7 +119,8 @@ var SvgExporter = this.SvgExporter = new function() {
|
||||||
|
|
||||||
function determineAngle(path, segments, type, center) {
|
function determineAngle(path, segments, type, center) {
|
||||||
// If the object is a circle, ellipse, rectangle, or rounded rectangle,
|
// If the object is a circle, ellipse, rectangle, or rounded rectangle,
|
||||||
// see if they are placed at an angle.
|
// see if it is placed at an angle, by figuring out its topCenter point
|
||||||
|
// and measuring the angle to its center.
|
||||||
var topCenter = type === 'rect'
|
var topCenter = type === 'rect'
|
||||||
? segments[1]._point.add(segments[2]._point).divide(2)
|
? segments[1]._point.add(segments[2]._point).divide(2)
|
||||||
: type === 'roundrect'
|
: type === 'roundrect'
|
||||||
|
@ -127,11 +128,8 @@ var SvgExporter = this.SvgExporter = new function() {
|
||||||
: type === 'circle' || type === 'ellipse'
|
: type === 'circle' || type === 'ellipse'
|
||||||
? segments[1]._point
|
? segments[1]._point
|
||||||
: null;
|
: null;
|
||||||
if (topCenter) {
|
var angle = topCenter && topCenter.subtract(center).getAngle() + 90;
|
||||||
var angle = topCenter.subtract(center).getAngle() + 90;
|
return Numerical.isZero(angle || 0) ? 0 : angle;
|
||||||
return Numerical.isZero(angle) ? 0 : angle;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function determineType(path, segments) {
|
function determineType(path, segments) {
|
||||||
|
|
Loading…
Reference in a new issue