Add an optional ignoreLinear parameter to Curve#divide, so that new segments on linear curves will keep their correct bezier handles.

This commit is contained in:
hkrish 2013-12-23 23:38:12 +01:00
parent 20b6d699db
commit 3b013c0720

View file

@ -348,13 +348,13 @@ var Curve = Base.extend(/** @lends Curve# */{
* @return {Curve} the second part of the divided curve
*/
// TODO: Rename to divideAt()?
divide: function(offset, isParameter) {
divide: function(offset, isParameter, ignoreLinear) {
var parameter = this._getParameter(offset, isParameter),
tolerance = /*#=*/ Numerical.TOLERANCE,
res = null;
if (parameter > tolerance && parameter < 1 - tolerance) {
var parts = Curve.subdivide(this.getValues(), parameter),
isLinear = this.isLinear(),
isLinear = ignoreLinear ? false : this.isLinear(),
left = parts[0],
right = parts[1];