mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
removed plugins directory because Kinetic will be using a configurator in the near future
This commit is contained in:
parent
87182d704c
commit
75b20573cd
2
Thorfile
2
Thorfile
@ -6,7 +6,7 @@ class Build < Thor
|
|||||||
"license.js", "src/Global.js", "src/Transition.js", "src/filters/Grayscale.js",
|
"license.js", "src/Global.js", "src/Transition.js", "src/filters/Grayscale.js",
|
||||||
"src/util/Type.js", "src/util/Canvas.js", "src/util/Class.js", "src/util/Tween.js", "src/util/Transform.js",
|
"src/util/Type.js", "src/util/Canvas.js", "src/util/Class.js", "src/util/Tween.js", "src/util/Transform.js",
|
||||||
"src/Animation.js", "src/Node.js", "src/Container.js", "src/Stage.js", "src/Layer.js", "src/Group.js", "src/Shape.js",
|
"src/Animation.js", "src/Node.js", "src/Container.js", "src/Stage.js", "src/Layer.js", "src/Group.js", "src/Shape.js",
|
||||||
"src/shapes/Rect.js", "src/shapes/Ellipse.js", "src/shapes/Image.js", "src/shapes/Polygon.js", "src/shapes/Text.js", "src/shapes/Line.js", "src/shapes/Sprite.js"
|
"src/shapes/Rect.js", "src/shapes/Ellipse.js", "src/shapes/Image.js", "src/shapes/Polygon.js", "src/shapes/Text.js", "src/shapes/Line.js", "src/shapes/Sprite.js", "src/shapes/Star.js", "src/shapes/RegularPolygon.js", "src/shapes/Path.js", "src/shapes/TextPath.js"
|
||||||
]
|
]
|
||||||
|
|
||||||
desc "dev", "Concatenate all the js files into /dist/kinetic-VERSION.js."
|
desc "dev", "Concatenate all the js files into /dist/kinetic-VERSION.js."
|
||||||
|
1076
dist/kinetic-core.js
vendored
1076
dist/kinetic-core.js
vendored
File diff suppressed because it is too large
Load Diff
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -8,7 +8,7 @@
|
|||||||
* @augments Kinetic.Shape
|
* @augments Kinetic.Shape
|
||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
*/
|
*/
|
||||||
Kinetic.Plugins.Path = Kinetic.Shape.extend({
|
Kinetic.Path = Kinetic.Shape.extend({
|
||||||
init: function(config) {
|
init: function(config) {
|
||||||
this.shapeType = "Path";
|
this.shapeType = "Path";
|
||||||
this.dataArray = [];
|
this.dataArray = [];
|
||||||
@ -17,9 +17,9 @@ Kinetic.Plugins.Path = Kinetic.Shape.extend({
|
|||||||
config.drawFunc = this.drawFunc;
|
config.drawFunc = this.drawFunc;
|
||||||
// call super constructor
|
// call super constructor
|
||||||
this._super(config);
|
this._super(config);
|
||||||
this.dataArray = Kinetic.Plugins.Path.parsePathData(this.attrs.data);
|
this.dataArray = Kinetic.Path.parsePathData(this.attrs.data);
|
||||||
this.on('dataChange', function() {
|
this.on('dataChange', function() {
|
||||||
that.dataArray = Kinetic.Plugins.Path.parsePathData(that.attrs.data);
|
that.dataArray = Kinetic.Path.parsePathData(that.attrs.data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
drawFunc: function(context) {
|
drawFunc: function(context) {
|
||||||
@ -72,10 +72,10 @@ Kinetic.Plugins.Path = Kinetic.Shape.extend({
|
|||||||
* Utility methods written by jfollas to
|
* Utility methods written by jfollas to
|
||||||
* handle length and point measurements
|
* handle length and point measurements
|
||||||
*/
|
*/
|
||||||
Kinetic.Plugins.Path.getLineLength = function(x1, y1, x2, y2) {
|
Kinetic.Path.getLineLength = function(x1, y1, x2, y2) {
|
||||||
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
||||||
};
|
};
|
||||||
Kinetic.Plugins.Path.getPointOnLine = function(dist, P1x, P1y, P2x, P2y, fromX, fromY) {
|
Kinetic.Path.getPointOnLine = function(dist, P1x, P1y, P2x, P2y, fromX, fromY) {
|
||||||
if(fromX === undefined) {
|
if(fromX === undefined) {
|
||||||
fromX = P1x;
|
fromX = P1x;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ Kinetic.Plugins.Path.getPointOnLine = function(dist, P1x, P1y, P2x, P2y, fromX,
|
|||||||
return pt;
|
return pt;
|
||||||
};
|
};
|
||||||
|
|
||||||
Kinetic.Plugins.Path.getPointOnCubicBezier = function(pct, P1x, P1y, P2x, P2y, P3x, P3y, P4x, P4y) {
|
Kinetic.Path.getPointOnCubicBezier = function(pct, P1x, P1y, P2x, P2y, P3x, P3y, P4x, P4y) {
|
||||||
function CB1(t) {
|
function CB1(t) {
|
||||||
return t * t * t;
|
return t * t * t;
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ Kinetic.Plugins.Path.getPointOnCubicBezier = function(pct, P1x, P1y, P2x, P2y, P
|
|||||||
y: y
|
y: y
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
Kinetic.Plugins.Path.getPointOnQuadraticBezier = function(pct, P1x, P1y, P2x, P2y, P3x, P3y) {
|
Kinetic.Path.getPointOnQuadraticBezier = function(pct, P1x, P1y, P2x, P2y, P3x, P3y) {
|
||||||
function QB1(t) {
|
function QB1(t) {
|
||||||
return t * t;
|
return t * t;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ Kinetic.Plugins.Path.getPointOnQuadraticBezier = function(pct, P1x, P1y, P2x, P2
|
|||||||
y: y
|
y: y
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
Kinetic.Plugins.Path.getPointOnEllipticalArc = function(cx, cy, rx, ry, theta, psi) {
|
Kinetic.Path.getPointOnEllipticalArc = function(cx, cy, rx, ry, theta, psi) {
|
||||||
var cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);
|
var cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);
|
||||||
var pt = {
|
var pt = {
|
||||||
x: rx * Math.cos(theta),
|
x: rx * Math.cos(theta),
|
||||||
@ -175,7 +175,7 @@ Kinetic.Plugins.Path.getPointOnEllipticalArc = function(cx, cy, rx, ry, theta, p
|
|||||||
* L data for the purpose of high performance Path
|
* L data for the purpose of high performance Path
|
||||||
* rendering
|
* rendering
|
||||||
*/
|
*/
|
||||||
Kinetic.Plugins.Path.parsePathData = function(data) {
|
Kinetic.Path.parsePathData = function(data) {
|
||||||
// Path Data Segment must begin with a moveTo
|
// Path Data Segment must begin with a moveTo
|
||||||
//m (x y)+ Relative moveTo (subsequent points are treated as lineTo)
|
//m (x y)+ Relative moveTo (subsequent points are treated as lineTo)
|
||||||
//M (x y)+ Absolute moveTo (subsequent points are treated as lineTo)
|
//M (x y)+ Absolute moveTo (subsequent points are treated as lineTo)
|
||||||
@ -414,9 +414,9 @@ Kinetic.Plugins.Path.parsePathData = function(data) {
|
|||||||
|
|
||||||
return ca;
|
return ca;
|
||||||
};
|
};
|
||||||
Kinetic.Plugins.Path.calcLength = function(x, y, cmd, points) {
|
Kinetic.Path.calcLength = function(x, y, cmd, points) {
|
||||||
var len, p1, p2;
|
var len, p1, p2;
|
||||||
var path = Kinetic.Plugins.Path;
|
var path = Kinetic.Path;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 'L':
|
case 'L':
|
||||||
@ -478,7 +478,7 @@ Kinetic.Plugins.Path.calcLength = function(x, y, cmd, points) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
Kinetic.Plugins.Path.convertEndpointToCenterParameterization = function(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) {
|
Kinetic.Path.convertEndpointToCenterParameterization = function(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) {
|
||||||
// Derived from: http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
|
// Derived from: http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
|
||||||
var psi = psiDeg * (Math.PI / 180.0);
|
var psi = psiDeg * (Math.PI / 180.0);
|
||||||
var xp = Math.cos(psi) * (x1 - x2) / 2.0 + Math.sin(psi) * (y1 - y2) / 2.0;
|
var xp = Math.cos(psi) * (x1 - x2) / 2.0 + Math.sin(psi) * (y1 - y2) / 2.0;
|
||||||
@ -536,7 +536,7 @@ Kinetic.Plugins.Path.convertEndpointToCenterParameterization = function(x1, y1,
|
|||||||
};
|
};
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Kinetic.Node.addGettersSetters(Kinetic.Plugins.Path, ['data']);
|
Kinetic.Node.addGettersSetters(Kinetic.Path, ['data']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set SVG path data string. This method
|
* set SVG path data string. This method
|
||||||
@ -544,12 +544,12 @@ Kinetic.Node.addGettersSetters(Kinetic.Plugins.Path, ['data']);
|
|||||||
* into a data array. Currently supported SVG data:
|
* into a data array. Currently supported SVG data:
|
||||||
* M, m, L, l, H, h, V, v, Q, q, T, t, C, c, S, s, A, a, Z, z
|
* M, m, L, l, H, h, V, v, Q, q, T, t, C, c, S, s, A, a, Z, z
|
||||||
* @name setData
|
* @name setData
|
||||||
* @methodOf Kinetic.Plugins.Path.prototype
|
* @methodOf Kinetic.Path.prototype
|
||||||
* @param {String} SVG path command string
|
* @param {String} SVG path command string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get SVG path data string
|
* get SVG path data string
|
||||||
* @name getData
|
* @name getData
|
||||||
* @methodOf Kinetic.Plugins.Path.prototype
|
* @methodOf Kinetic.Path.prototype
|
||||||
*/
|
*/
|
@ -7,7 +7,7 @@
|
|||||||
* @augments Kinetic.Shape
|
* @augments Kinetic.Shape
|
||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
*/
|
*/
|
||||||
Kinetic.Plugins.RegularPolygon = Kinetic.Shape.extend({
|
Kinetic.RegularPolygon = Kinetic.Shape.extend({
|
||||||
init: function(config) {
|
init: function(config) {
|
||||||
this.setDefaultAttrs({
|
this.setDefaultAttrs({
|
||||||
radius: 0,
|
radius: 0,
|
||||||
@ -35,29 +35,29 @@ Kinetic.Plugins.RegularPolygon = Kinetic.Shape.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Kinetic.Node.addGettersSetters(Kinetic.Plugins.RegularPolygon, ['radius', 'sides']);
|
Kinetic.Node.addGettersSetters(Kinetic.RegularPolygon, ['radius', 'sides']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set radius
|
* set radius
|
||||||
* @name setRadius
|
* @name setRadius
|
||||||
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
|
* @methodOf Kinetic.RegularPolygon.prototype
|
||||||
* @param {Number} radius
|
* @param {Number} radius
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set number of sides
|
* set number of sides
|
||||||
* @name setSides
|
* @name setSides
|
||||||
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
|
* @methodOf Kinetic.RegularPolygon.prototype
|
||||||
* @param {int} sides
|
* @param {int} sides
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* get radius
|
* get radius
|
||||||
* @name getRadius
|
* @name getRadius
|
||||||
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
|
* @methodOf Kinetic.RegularPolygon.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get number of sides
|
* get number of sides
|
||||||
* @name getSides
|
* @name getSides
|
||||||
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
|
* @methodOf Kinetic.RegularPolygon.prototype
|
||||||
*/
|
*/
|
@ -7,7 +7,7 @@
|
|||||||
* @augments Kinetic.Shape
|
* @augments Kinetic.Shape
|
||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
*/
|
*/
|
||||||
Kinetic.Plugins.Star = Kinetic.Shape.extend({
|
Kinetic.Star = Kinetic.Shape.extend({
|
||||||
init: function(config) {
|
init: function(config) {
|
||||||
this.setDefaultAttrs({
|
this.setDefaultAttrs({
|
||||||
numPoints: 0,
|
numPoints: 0,
|
||||||
@ -38,43 +38,43 @@ Kinetic.Plugins.Star = Kinetic.Shape.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Kinetic.Node.addGettersSetters(Kinetic.Plugins.Star, ['numPoints', 'innerRadius', 'outerRadius']);
|
Kinetic.Node.addGettersSetters(Kinetic.Star, ['numPoints', 'innerRadius', 'outerRadius']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set number of points
|
* set number of points
|
||||||
* @name setNumPoints
|
* @name setNumPoints
|
||||||
* @methodOf Kinetic.Plugins.Star.prototype
|
* @methodOf Kinetic.Star.prototype
|
||||||
* @param {Integer} points
|
* @param {Integer} points
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set outer radius
|
* set outer radius
|
||||||
* @name setOuterRadius
|
* @name setOuterRadius
|
||||||
* @methodOf Kinetic.Plugins.Star.prototype
|
* @methodOf Kinetic.Star.prototype
|
||||||
* @param {Number} radius
|
* @param {Number} radius
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set inner radius
|
* set inner radius
|
||||||
* @name setInnerRadius
|
* @name setInnerRadius
|
||||||
* @methodOf Kinetic.Plugins.Star.prototype
|
* @methodOf Kinetic.Star.prototype
|
||||||
* @param {Number} radius
|
* @param {Number} radius
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get number of points
|
* get number of points
|
||||||
* @name getNumPoints
|
* @name getNumPoints
|
||||||
* @methodOf Kinetic.Plugins.Star.prototype
|
* @methodOf Kinetic.Star.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get outer radius
|
* get outer radius
|
||||||
* @name getOuterRadius
|
* @name getOuterRadius
|
||||||
* @methodOf Kinetic.Plugins.Star.prototype
|
* @methodOf Kinetic.Star.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get inner radius
|
* get inner radius
|
||||||
* @name getInnerRadius
|
* @name getInnerRadius
|
||||||
* @methodOf Kinetic.Plugins.Star.prototype
|
* @methodOf Kinetic.Star.prototype
|
||||||
*/
|
*/
|
@ -8,7 +8,7 @@
|
|||||||
* @augments Kinetic.Shape
|
* @augments Kinetic.Shape
|
||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
*/
|
*/
|
||||||
Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
Kinetic.TextPath = Kinetic.Shape.extend({
|
||||||
init: function(config) {
|
init: function(config) {
|
||||||
this.setDefaultAttrs({
|
this.setDefaultAttrs({
|
||||||
fontFamily: 'Calibri',
|
fontFamily: 'Calibri',
|
||||||
@ -26,9 +26,9 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
config.drawFunc = this.drawFunc;
|
config.drawFunc = this.drawFunc;
|
||||||
// call super constructor
|
// call super constructor
|
||||||
this._super(config);
|
this._super(config);
|
||||||
this.dataArray = Kinetic.Plugins.Path.parsePathData(this.attrs.data);
|
this.dataArray = Kinetic.Path.parsePathData(this.attrs.data);
|
||||||
this.on('dataChange', function() {
|
this.on('dataChange', function() {
|
||||||
that.dataArray = Kinetic.Plugins.Path.parsePathData(this.attrs.data);
|
that.dataArray = Kinetic.Path.parsePathData(this.attrs.data);
|
||||||
});
|
});
|
||||||
// update text data for certain attr changes
|
// update text data for certain attr changes
|
||||||
var attrs = ['text', 'textStroke', 'textStrokeWidth'];
|
var attrs = ['text', 'textStroke', 'textStrokeWidth'];
|
||||||
@ -81,7 +81,7 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
/**
|
/**
|
||||||
* get text width in pixels
|
* get text width in pixels
|
||||||
* @name getTextWidth
|
* @name getTextWidth
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
getTextWidth: function() {
|
getTextWidth: function() {
|
||||||
return this.textWidth;
|
return this.textWidth;
|
||||||
@ -89,7 +89,7 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
/**
|
/**
|
||||||
* get text height in pixels
|
* get text height in pixels
|
||||||
* @name getTextHeight
|
* @name getTextHeight
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
getTextHeight: function() {
|
getTextHeight: function() {
|
||||||
return this.textHeight;
|
return this.textHeight;
|
||||||
@ -176,8 +176,8 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
|
|
||||||
switch (pathCmd.command) {
|
switch (pathCmd.command) {
|
||||||
case 'L':
|
case 'L':
|
||||||
if(Kinetic.Plugins.Path.getLineLength(p0.x, p0.y, pathCmd.points[0], pathCmd.points[1]) > glyphWidth) {
|
if(Kinetic.Path.getLineLength(p0.x, p0.y, pathCmd.points[0], pathCmd.points[1]) > glyphWidth) {
|
||||||
p1 = Kinetic.Plugins.Path.getPointOnLine(glyphWidth, p0.x, p0.y, pathCmd.points[0], pathCmd.points[1], p0.x, p0.y);
|
p1 = Kinetic.Path.getPointOnLine(glyphWidth, p0.x, p0.y, pathCmd.points[0], pathCmd.points[1], p0.x, p0.y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pathCmd = undefined;
|
pathCmd = undefined;
|
||||||
@ -202,7 +202,7 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
currentT = end;
|
currentT = end;
|
||||||
needNewSegment = true;
|
needNewSegment = true;
|
||||||
}
|
}
|
||||||
p1 = Kinetic.Plugins.Path.getPointOnEllipticalArc(pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3], currentT, pathCmd.points[6]);
|
p1 = Kinetic.Path.getPointOnEllipticalArc(pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3], currentT, pathCmd.points[6]);
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if(currentT === 0) {
|
if(currentT === 0) {
|
||||||
@ -220,7 +220,7 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
currentT = 1.0;
|
currentT = 1.0;
|
||||||
needNewSegment = true;
|
needNewSegment = true;
|
||||||
}
|
}
|
||||||
p1 = Kinetic.Plugins.Path.getPointOnCubicBezier(currentT, pathCmd.start.x, pathCmd.start.y, pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3], pathCmd.points[4], pathCmd.points[5]);
|
p1 = Kinetic.Path.getPointOnCubicBezier(currentT, pathCmd.start.x, pathCmd.start.y, pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3], pathCmd.points[4], pathCmd.points[5]);
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
if(currentT === 0)
|
if(currentT === 0)
|
||||||
@ -234,13 +234,13 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
currentT = 1.0;
|
currentT = 1.0;
|
||||||
needNewSegment = true;
|
needNewSegment = true;
|
||||||
}
|
}
|
||||||
p1 = Kinetic.Plugins.Path.getPointOnQuadraticBezier(currentT, pathCmd.start.x, pathCmd.start.y, pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3]);
|
p1 = Kinetic.Path.getPointOnQuadraticBezier(currentT, pathCmd.start.x, pathCmd.start.y, pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p1 !== undefined) {
|
if(p1 !== undefined) {
|
||||||
currLen = Kinetic.Plugins.Path.getLineLength(p0.x, p0.y, p1.x, p1.y);
|
currLen = Kinetic.Path.getLineLength(p0.x, p0.y, p1.x, p1.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(needNewSegment) {
|
if(needNewSegment) {
|
||||||
@ -257,7 +257,7 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
if(p0 === undefined || p1 === undefined)
|
if(p0 === undefined || p1 === undefined)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
var width = Kinetic.Plugins.Path.getLineLength(p0.x, p0.y, p1.x, p1.y);
|
var width = Kinetic.Path.getLineLength(p0.x, p0.y, p1.x, p1.y);
|
||||||
|
|
||||||
// Note: Since glyphs are rendered one at a time, any kerning pair data built into the font will not be used.
|
// Note: Since glyphs are rendered one at a time, any kerning pair data built into the font will not be used.
|
||||||
// Can foresee having a rough pair table built in that the developer can override as needed.
|
// Can foresee having a rough pair table built in that the developer can override as needed.
|
||||||
@ -265,7 +265,7 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
var kern = 0;
|
var kern = 0;
|
||||||
// placeholder for future implementation
|
// placeholder for future implementation
|
||||||
|
|
||||||
var midpoint = Kinetic.Plugins.Path.getPointOnLine(kern + width / 2.0, p0.x, p0.y, p1.x, p1.y);
|
var midpoint = Kinetic.Path.getPointOnLine(kern + width / 2.0, p0.x, p0.y, p1.x, p1.y);
|
||||||
|
|
||||||
var rotation = Math.atan2((p1.y - p0.y), (p1.x - p0.x));
|
var rotation = Math.atan2((p1.y - p0.y), (p1.x - p0.x));
|
||||||
this.glyphInfo.push({
|
this.glyphInfo.push({
|
||||||
@ -282,95 +282,95 @@ Kinetic.Plugins.TextPath = Kinetic.Shape.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// add setters and getters
|
// add setters and getters
|
||||||
Kinetic.Node.addGettersSetters(Kinetic.Plugins.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth', 'text']);
|
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth', 'text']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set font family
|
* set font family
|
||||||
* @name setFontFamily
|
* @name setFontFamily
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
* @param {String} fontFamily
|
* @param {String} fontFamily
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set font size
|
* set font size
|
||||||
* @name setFontSize
|
* @name setFontSize
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
* @param {int} fontSize
|
* @param {int} fontSize
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set font style. Can be "normal", "italic", or "bold". "normal" is the default.
|
* set font style. Can be "normal", "italic", or "bold". "normal" is the default.
|
||||||
* @name setFontStyle
|
* @name setFontStyle
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
* @param {String} fontStyle
|
* @param {String} fontStyle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set text fill color
|
* set text fill color
|
||||||
* @name setTextFill
|
* @name setTextFill
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
* @param {String} textFill
|
* @param {String} textFill
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set text stroke color
|
* set text stroke color
|
||||||
* @name setFontStroke
|
* @name setFontStroke
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
* @param {String} textStroke
|
* @param {String} textStroke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set text stroke width
|
* set text stroke width
|
||||||
* @name setTextStrokeWidth
|
* @name setTextStrokeWidth
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
* @param {int} textStrokeWidth
|
* @param {int} textStrokeWidth
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set text
|
* set text
|
||||||
* @name setText
|
* @name setText
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
* @param {String} text
|
* @param {String} text
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get font family
|
* get font family
|
||||||
* @name getFontFamily
|
* @name getFontFamily
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get font size
|
* get font size
|
||||||
* @name getFontSize
|
* @name getFontSize
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get font style
|
* get font style
|
||||||
* @name getFontStyle
|
* @name getFontStyle
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get text fill color
|
* get text fill color
|
||||||
* @name getTextFill
|
* @name getTextFill
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get text stroke color
|
* get text stroke color
|
||||||
* @name getTextStroke
|
* @name getTextStroke
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get text stroke width
|
* get text stroke width
|
||||||
* @name getTextStrokeWidth
|
* @name getTextStrokeWidth
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get text
|
* get text
|
||||||
* @name getText
|
* @name getText
|
||||||
* @methodOf Kinetic.Plugins.TextPath.prototype
|
* @methodOf Kinetic.TextPath.prototype
|
||||||
*/
|
*/
|
@ -3,11 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css"href="../base.css">
|
<link rel="stylesheet" type="text/css"href="../base.css">
|
||||||
<script src="../../dist/kinetic-core.js"></script>
|
<script src="../../dist/kinetic-core.js"></script>
|
||||||
<!-- plugins -->
|
|
||||||
<script src="../../src/plugins/shapes/Path.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/RegularPolygon.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/Star.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/TextPath.js"></script>
|
|
||||||
<!-- assets -->
|
<!-- assets -->
|
||||||
<script src="../js/Test.js"></script>
|
<script src="../js/Test.js"></script>
|
||||||
<script src="../js/manualTests.js"></script>
|
<script src="../js/manualTests.js"></script>
|
||||||
|
@ -3,11 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css"href="../base.css">
|
<link rel="stylesheet" type="text/css"href="../base.css">
|
||||||
<script src="../../dist/kinetic-core.js"></script>
|
<script src="../../dist/kinetic-core.js"></script>
|
||||||
<!-- plugins -->
|
|
||||||
<script src="../../src/plugins/shapes/Path.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/RegularPolygon.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/Star.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/TextPath.js"></script>
|
|
||||||
<!-- assets -->
|
<!-- assets -->
|
||||||
<script src="../js/Test.js"></script>
|
<script src="../js/Test.js"></script>
|
||||||
<script src="../js/performanceTests.js"></script>
|
<script src="../js/performanceTests.js"></script>
|
||||||
|
@ -3,12 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css"href="../base.css">
|
<link rel="stylesheet" type="text/css"href="../base.css">
|
||||||
<script src="../../dist/kinetic-core.js"></script>
|
<script src="../../dist/kinetic-core.js"></script>
|
||||||
<!-- plugins -->
|
|
||||||
<script src="../../src/plugins/shapes/RegularPolygon.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/Star.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/Path.js"></script>
|
|
||||||
<script src="../../src/plugins/shapes/TextPath.js"></script>
|
|
||||||
<script src="../../src/plugins/util/PathHelper.js"></script>
|
|
||||||
<!-- assets -->
|
<!-- assets -->
|
||||||
<script src="../assets/worldMap.js"></script>
|
<script src="../assets/worldMap.js"></script>
|
||||||
<script src="../assets/tiger.js"></script>
|
<script src="../assets/tiger.js"></script>
|
||||||
|
@ -266,7 +266,7 @@ Test.prototype.tests = {
|
|||||||
});
|
});
|
||||||
var layer = new Kinetic.Layer();
|
var layer = new Kinetic.Layer();
|
||||||
|
|
||||||
var star = new Kinetic.Plugins.Star({
|
var star = new Kinetic.Star({
|
||||||
x: 200,
|
x: 200,
|
||||||
y: 100,
|
y: 100,
|
||||||
numPoints: 10,
|
numPoints: 10,
|
||||||
@ -337,7 +337,7 @@ Test.prototype.tests = {
|
|||||||
var layer = new Kinetic.Layer({
|
var layer = new Kinetic.Layer({
|
||||||
rotationDeg: 20
|
rotationDeg: 20
|
||||||
});
|
});
|
||||||
var star = new Kinetic.Plugins.Star({
|
var star = new Kinetic.Star({
|
||||||
x: 200,
|
x: 200,
|
||||||
y: 100,
|
y: 100,
|
||||||
numPoints: 10,
|
numPoints: 10,
|
||||||
@ -717,7 +717,7 @@ Test.prototype.tests = {
|
|||||||
});
|
});
|
||||||
var layer = new Kinetic.Layer();
|
var layer = new Kinetic.Layer();
|
||||||
|
|
||||||
var star = new Kinetic.Plugins.Star({
|
var star = new Kinetic.Star({
|
||||||
x: 200,
|
x: 200,
|
||||||
y: 100,
|
y: 100,
|
||||||
numPoints: 5,
|
numPoints: 5,
|
||||||
|
@ -148,7 +148,7 @@ Test.prototype.tests = {
|
|||||||
|
|
||||||
startTimer();
|
startTimer();
|
||||||
for(var n = 0; n < 1000; n++) {
|
for(var n = 0; n < 1000; n++) {
|
||||||
var star = new Kinetic.Plugins.Star({
|
var star = new Kinetic.Star({
|
||||||
innerRadius: 20,
|
innerRadius: 20,
|
||||||
outerRadius: 50,
|
outerRadius: 50,
|
||||||
fill: 'yellow',
|
fill: 'yellow',
|
||||||
@ -180,7 +180,7 @@ Test.prototype.tests = {
|
|||||||
});
|
});
|
||||||
var layer = new Kinetic.Layer();
|
var layer = new Kinetic.Layer();
|
||||||
|
|
||||||
var star = new Kinetic.Plugins.Star({
|
var star = new Kinetic.Star({
|
||||||
innerRadius: 20,
|
innerRadius: 20,
|
||||||
outerRadius: 50,
|
outerRadius: 50,
|
||||||
fill: 'yellow',
|
fill: 'yellow',
|
||||||
@ -236,7 +236,7 @@ Test.prototype.tests = {
|
|||||||
for(var key in worldMap.shapes) {
|
for(var key in worldMap.shapes) {
|
||||||
var c = worldMap.shapes[key];
|
var c = worldMap.shapes[key];
|
||||||
|
|
||||||
var path = new Kinetic.Plugins.Path({
|
var path = new Kinetic.Path({
|
||||||
data: c,
|
data: c,
|
||||||
fill: '#ccc',
|
fill: '#ccc',
|
||||||
stroke: '#999',
|
stroke: '#999',
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user