From 7cbd26d475eaad817042692f9116f9a24ae60997 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 28 Feb 2012 10:24:06 -0800 Subject: Bug fixes: 1152: allow deleting of multiple paths from inside pen tool 1128: keyboard hotkey shortcut 'P' for pen tool 941: changing width or height of the path scales the path --- js/helper-classes/RDGE/GLSubpath.js | 64 ++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) (limited to 'js/helper-classes/RDGE/GLSubpath.js') diff --git a/js/helper-classes/RDGE/GLSubpath.js b/js/helper-classes/RDGE/GLSubpath.js index 3200cf59..7beb11b9 100755 --- a/js/helper-classes/RDGE/GLSubpath.js +++ b/js/helper-classes/RDGE/GLSubpath.js @@ -178,6 +178,65 @@ function GLSubpath() { } //render() this.geomType = function () { return this.GEOM_TYPE_CUBIC_BEZIER; } + + + this.setWidth = function (newW) { + //todo this doesn't work in cases where the newW is zero or if the previous width was 0/1 (i.e. the path had become degenerate in width) + //todo same as above for the setHeight function below + //scale the contents of this subpath to lie within this width + //determine the scale factor by comparing with the old width + var oldWidth = this._BBoxMax[0]-this._BBoxMin[0]; + if (oldWidth<1){ + oldWidth=1; + } + var scaleX = newW/oldWidth; + if (scaleX===1){ + return; //no need to do anything + } + + //scale the anchor point positions such that the width of the bbox is the newW + var origX = this._BBoxMin[0]; + var numAnchors = this._Anchors.length; + for (var i=0;i