};
function SVGPathSeg() {
- /*readonly unsigned short*/ this.pathSegType = SVGPathSeg.PATHSEG_UNKNOWN;
+ /*readonly unsigned short*/ this.pathSegType = /*SVGPathSeg.PATHSEG_UNKNOWN*/ 0;
/*readonly DOMString*/ this.pathSegTypeAsLetter = null;
return this;
};
-(function(t) {
+/*(function(t) {
// Path Segment Types
- /*unsigned short*/ t.PATHSEG_UNKNOWN = 0;
- /*unsigned short*/ t.PATHSEG_CLOSEPATH = 1;
- /*unsigned short*/ t.PATHSEG_MOVETO_ABS = 2;
- /*unsigned short*/ t.PATHSEG_MOVETO_REL = 3;
- /*unsigned short*/ t.PATHSEG_LINETO_ABS = 4;
- /*unsigned short*/ t.PATHSEG_LINETO_REL = 5;
- /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_ABS = 6;
- /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_REL = 7;
- /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_ABS = 8;
- /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_REL = 9;
- /*unsigned short*/ t.PATHSEG_ARC_ABS = 10;
- /*unsigned short*/ t.PATHSEG_ARC_REL = 11;
- /*unsigned short*/ t.PATHSEG_LINETO_HORIZONTAL_ABS = 12;
- /*unsigned short*/ t.PATHSEG_LINETO_HORIZONTAL_REL = 13;
- /*unsigned short*/ t.PATHSEG_LINETO_VERTICAL_ABS = 14;
- /*unsigned short*/ t.PATHSEG_LINETO_VERTICAL_REL = 15;
- /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16;
- /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17;
- /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
- /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
-})(SVGPathSeg);
+ /*unsigned short t.PATHSEG_UNKNOWN = 0;
+ /*unsigned short t.PATHSEG_CLOSEPATH = 1;
+ /*unsigned short t.PATHSEG_MOVETO_ABS = 2;
+ /*unsigned short t.PATHSEG_MOVETO_REL = 3;
+ /*unsigned short t.PATHSEG_LINETO_ABS = 4;
+ /*unsigned short t.PATHSEG_LINETO_REL = 5;
+ /*unsigned short t.PATHSEG_CURVETO_CUBIC_ABS = 6;
+ /*unsigned short t.PATHSEG_CURVETO_CUBIC_REL = 7;
+ /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_ABS = 8;
+ /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_REL = 9;
+ /*unsigned short t.PATHSEG_ARC_ABS = 10;
+ /*unsigned short t.PATHSEG_ARC_REL = 11;
+ /*unsigned short t.PATHSEG_LINETO_HORIZONTAL_ABS = 12;
+ /*unsigned short t.PATHSEG_LINETO_HORIZONTAL_REL = 13;
+ /*unsigned short t.PATHSEG_LINETO_VERTICAL_ABS = 14;
+ /*unsigned short t.PATHSEG_LINETO_VERTICAL_REL = 15;
+ /*unsigned short t.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16;
+ /*unsigned short t.PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17;
+ /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
+ /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
+})(SVGPathSeg);*/
/*SVGPathSegxx
*軽量化のために、SVGPathSegの継承をしない。また、{}オブジェクトで代用する予定
*/
return this;
};
SVGPathSegClosePath.prototype = {
- pathSegType : SVGPathSeg.PATHSEG_CLOSEPATH,
+ pathSegType : /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1,
pathSegTypeAsLetter : "z"
};
function SVGPathSegMovetoAbs() {
return this;
};
SVGPathSegMovetoAbs.prototype = {
- pathSegType : SVGPathSeg.PATHSEG_MOVETO_ABS,
+ pathSegType : /*SVGPathSeg.PATHSEG_MOVETO_ABS*/ 2,
pathSegTypeAsLetter : "M"
};
function SVGPathSegMovetoRel() {
return this;
};
SVGPathSegMovetoRel.prototype = {
- pathSegType : SVGPathSeg.PATHSEG_MOVETO_REL,
+ pathSegType : /*SVGPathSeg.PATHSEG_MOVETO_REL*/ 3,
pathSegTypeAsLetter : "m"
};
function SVGPathSegLinetoAbs() {
return this;
};
SVGPathSegLinetoAbs.prototype = {
- pathSegType : SVGPathSeg.PATHSEG_LINETO_ABS,
+ pathSegType : /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4,
pathSegTypeAsLetter : "L"
};
function SVGPathSegLinetoRel() {
return this;
};
SVGPathSegLinetoRel.prototype = {
- pathSegType : SVGPathSeg.PATHSEG_LINETO_REL,
+ pathSegType : /*SVGPathSeg.PATHSEG_LINETO_REL*/ 5,
pathSegTypeAsLetter : "l"
};
function SVGPathSegCurvetoCubicAbs() {
return this;
};
SVGPathSegCurvetoCubicAbs.prototype = {
- pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,
+ pathSegType : /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6,
pathSegTypeAsLetter : "C"
};
function SVGPathSegCurvetoCubicRel() {
return this;
};
SVGPathSegCurvetoCubicRel.prototype = {
- pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,
+ pathSegType : /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL*/ 7,
pathSegTypeAsLetter : "c"
};
function SVGPathSegCurvetoQuadraticAbs() {
/*float*/ this.y;
/*float*/ this.x1;
/*float*/ this.y1;
- this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS*/ 8;
this.pathSegTypeAsLetter = "Q";
return this;
};
/*float*/ this.y;
/*float*/ this.x1;
/*float*/ this.y1;
- this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL*/ 9;
this.pathSegTypeAsLetter = "q";
return this;
};
SVGPathSegArcAbs.prototype = {
/*boolean*/ largeArcFlag : true,
/*boolean*/ sweepFlag : true,
- pathSegType : SVGPathSeg.PATHSEG_ARC_ABS,
+ pathSegType : /*SVGPathSeg.PATHSEG_ARC_ABS*/ 10,
pathSegTypeAsLetter : "A"
};
function SVGPathSegArcRel() {
SVGPathSegArcRel.prototype = {
/*boolean*/ largeArcFlag : true,
/*boolean*/ sweepFlag : true,
- pathSegType : SVGPathSeg.PATHSEG_ARC_REL,
+ pathSegType : /*SVGPathSeg.PATHSEG_ARC_REL*/ 11,
pathSegTypeAsLetter : "a"
};
function SVGPathSegLinetoHorizontalAbs() {
/*float*/ this.x;
- this.pathSegType = SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS*/ 12;
this.pathSegTypeAsLetter = "H";
return this;
};
function SVGPathSegLinetoHorizontalRel() {
/*float*/ this.x;
- this.pathSegType = SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL*/ 13;
this.pathSegTypeAsLetter = "h";
return this;
};
function SVGPathSegLinetoVerticalAbs() {
/*float*/ this.y;
- this.pathSegType = SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS*/ 14;
this.pathSegTypeAsLetter = "V";
return this;
};
function SVGPathSegLinetoVerticalRel() {
/*float*/ this.y;
- this.pathSegType = SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL*/ 15;
this.pathSegTypeAsLetter = "v";
return this;
};
/*float*/ this.y;
/*float*/ this.x2;
/*float*/ this.y2;
- this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS*/ 16;
this.pathSegTypeAsLetter = "S";
return this;
};
/*float*/ this.y;
/*float*/ this.x2;
/*float*/ this.y2;
- this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL*/ 17;
this.pathSegTypeAsLetter = "s";
return this;
};
function SVGPathSegCurvetoQuadraticSmoothAbs() {
/*float*/ this.x;
/*float*/ this.y;
- this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS*/ 18;
this.pathSegTypeAsLetter = "T";
return this;
};
function SVGPathSegCurvetoQuadraticSmoothRel() {
/*float*/ this.x;
/*float*/ this.y;
- this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
+ this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL*/ 19;
this.pathSegTypeAsLetter = "t";
return this;
};
nl = this.normalizedPathSegList;
for (var i=1,nln=nl.numberOfItems,ms=null;i<nln;++i) {
var seg = nl.getItem(i);
- if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
+ if (seg.pathSegType === /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4) {
var ps = nl.getItem(i-1);
s += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
- } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
+ } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6) {
var ps = nl.getItem(i-1), dd = 0;
/*2点のハンドルを結んだ線分の3辺と、
*セグメントの始点と終点を結んだ1辺を足して2で割ったものを、ベジェ曲線の距離の近似値とする
dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
dd += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
s += dd / 2;
- } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
+ } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1) {
var ps = nl.getItem(i-1), ms = nl.getItem(0);
s += _math.sqrt(_math.pow((ps.x-ms.x), 2) + _math.pow((ps.y-ms.y), 2));
}
return s;
}
var ps = nl.getItem(segn-1);
- if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
+ if (seg.pathSegType === /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4) {
var segl = _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
var t = (segl + this._dis) / segl;
s.x = ps.x + t * (seg.x-ps.x);
s.y = ps.y + t * (seg.y-ps.y);
- } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
+ } else if (seg.pathSegType === /*VGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6) {
var dd = 0;
dd += _math.sqrt(_math.pow((seg.x1-ps.x), 2) + _math.pow((seg.y1-ps.y), 2));
dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
+3*(ps.y - 2*seg.y1 + seg.y2) * _math.pow(t, 2)
+3*(seg.y1 - ps.y) * t
+ps.y;
- } else if (seg.pathSegType === SVGPathSeg.MOVETO_ABS) {
+ } else if (seg.pathSegType === /*SVGPathSeg.MOVETO_ABS*/ 2) {
s.x = seg.x;
s.y = seg.y;
- } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
+ } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1) {
var ms = nl.getItem(0), segl = _math.sqrt(_math.pow((seg.x-mx.x), 2) + _math.pow((seg.y-ms.y), 2));
var t = (segl + this._dis) / segl;
s.x = ms.x + t * (seg.x-ms.x);
var nl = this.normalizedPathSegList; //仕様ではpathSegList
for (var i=0,nln=nl.numberOfItems,ms=null;i<nln;++i) {
var seg = nl.getItem(i);
- if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
+ if (seg.pathSegType === /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4) {
var ps = nl.getItem(i-1);
distance -= _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
- } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
+ } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6) {
var ps = nl.getItem(i-1), dd = 0;
dd += _math.sqrt(_math.pow((seg.x1-ps.x), 2) + _math.pow((seg.y1-ps.y), 2));
dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
dd += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
distance -= dd / 2;
dd = void 0;
- } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
+ } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1) {
var ps = nl.getItem(i-1), ms = nl.getItem(0);
distance -= _math.sqrt(_math.pow((ps.x-ms.x), 2) + _math.pow((ps.y-ms.y), 2));
}