diff options
author | Ananya Sen | 2012-02-29 15:21:31 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-29 15:21:31 -0800 |
commit | 8fee7d6bdb55ba18f396c3523081b18499fa1e30 (patch) | |
tree | dbd17232983247a38bb6b2cea480242bdf3f2422 /js/helper-classes/RDGE/GLSubpath.js | |
parent | 5d4f1aad01737695238582c704e6d4f2c3a2f317 (diff) | |
parent | b09956e4a9a35c5588cc7cd1f01efb617cbe0884 (diff) | |
download | ninja-8fee7d6bdb55ba18f396c3523081b18499fa1e30.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into FileIO
Conflicts:
js/controllers/selection-controller.js
js/document/html-document.js
js/panels/properties/content.reel/content.js
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/GLSubpath.js')
-rwxr-xr-x | js/helper-classes/RDGE/GLSubpath.js | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/js/helper-classes/RDGE/GLSubpath.js b/js/helper-classes/RDGE/GLSubpath.js index 3200cf59..f3d8ad36 100755 --- a/js/helper-classes/RDGE/GLSubpath.js +++ b/js/helper-classes/RDGE/GLSubpath.js | |||
@@ -178,6 +178,67 @@ function GLSubpath() { | |||
178 | } //render() | 178 | } //render() |
179 | 179 | ||
180 | this.geomType = function () { return this.GEOM_TYPE_CUBIC_BEZIER; } | 180 | this.geomType = function () { return this.GEOM_TYPE_CUBIC_BEZIER; } |
181 | |||
182 | |||
183 | this.setWidth = function (newW) { | ||
184 | if (newW<1) | ||
185 | newW=1; //clamp minimum width to 1 | ||
186 | //scale the contents of this subpath to lie within this width | ||
187 | //determine the scale factor by comparing with the old width | ||
188 | var oldWidth = this._BBoxMax[0]-this._BBoxMin[0]; | ||
189 | if (oldWidth<1){ | ||
190 | oldWidth=1; | ||
191 | } | ||
192 | var scaleX = newW/oldWidth; | ||
193 | if (scaleX===1){ | ||
194 | return; //no need to do anything | ||
195 | } | ||
196 | |||
197 | //scale the anchor point positions such that the width of the bbox is the newW | ||
198 | var origX = this._BBoxMin[0]; | ||
199 | var numAnchors = this._Anchors.length; | ||
200 | for (var i=0;i<numAnchors;i++){ | ||
201 | //compute the distance from the bboxMin | ||
202 | var oldW = this._Anchors[i].getPosX() - origX; | ||
203 | var prevW = this._Anchors[i].getPrevX() - origX; | ||
204 | var nextW = this._Anchors[i].getNextX() - origX; | ||
205 | |||
206 | this._Anchors[i].setPos(origX + oldW*scaleX,this._Anchors[i].getPosY(),this._Anchors[i].getPosZ()); | ||
207 | this._Anchors[i].setPrevPos(origX + prevW*scaleX,this._Anchors[i].getPrevY(),this._Anchors[i].getPrevZ()); | ||
208 | this._Anchors[i].setNextPos(origX + nextW*scaleX,this._Anchors[i].getNextY(),this._Anchors[i].getNextZ()); | ||
209 | } | ||
210 | this.makeDirty(); | ||
211 | } | ||
212 | this.setHeight = function (newH) { | ||
213 | if (newH<1) | ||
214 | newH=1; //clamp minimum width to 1 | ||
215 | //scale the contents of this subpath to lie within this height | ||
216 | //determine the scale factor by comparing with the old height | ||
217 | var oldHeight = this._BBoxMax[1]-this._BBoxMin[1]; | ||
218 | if (oldHeight<1){ | ||
219 | oldHeight=1; | ||
220 | } | ||
221 | var scaleY = newH/oldHeight; | ||
222 | if (scaleY===1){ | ||
223 | return; //no need to do anything | ||
224 | } | ||
225 | |||
226 | //scale the anchor point positions such that the height of the bbox is the newH | ||
227 | var origY = this._BBoxMin[1]; | ||
228 | var numAnchors = this._Anchors.length; | ||
229 | for (var i=0;i<numAnchors;i++){ | ||
230 | //compute the distance from the bboxMin | ||
231 | var oldW = this._Anchors[i].getPosY() - origY; | ||
232 | var prevW = this._Anchors[i].getPrevY() - origY; | ||
233 | var nextW = this._Anchors[i].getNextY() - origY; | ||
234 | |||
235 | this._Anchors[i].setPos(this._Anchors[i].getPosX(), origY + oldW*scaleY,this._Anchors[i].getPosZ()); | ||
236 | this._Anchors[i].setPrevPos(this._Anchors[i].getPrevX(), origY + prevW*scaleY,this._Anchors[i].getPrevZ()); | ||
237 | this._Anchors[i].setNextPos(this._Anchors[i].getNextX(), origY + nextW*scaleY,this._Anchors[i].getNextZ()); | ||
238 | } | ||
239 | this.makeDirty(); | ||
240 | } | ||
241 | |||
181 | } //function GLSubpath ...class definition | 242 | } //function GLSubpath ...class definition |
182 | 243 | ||
183 | 244 | ||
@@ -573,11 +634,6 @@ GLSubpath.prototype.setFillMaterial = function(m){ this._fillMaterial = m;} | |||
573 | GLSubpath.prototype.getFillColor = function() {return this._fillColor;} | 634 | GLSubpath.prototype.getFillColor = function() {return this._fillColor;} |
574 | GLSubpath.prototype.setFillColor = function(c){this._fillColor = c;} | 635 | GLSubpath.prototype.setFillColor = function(c){this._fillColor = c;} |
575 | 636 | ||
576 | GLSubpath.prototype.setWidth = function () {//NO-OP for now | ||
577 | } | ||
578 | GLSubpath.prototype.setHeight = function () {//NO-OP for now | ||
579 | } | ||
580 | |||
581 | GLSubpath.prototype.copyFromSubpath = function (subpath) { | 637 | GLSubpath.prototype.copyFromSubpath = function (subpath) { |
582 | this.clearAllAnchors(); | 638 | this.clearAllAnchors(); |
583 | for (var i = 0; i < subpath.getNumAnchors(); i++) { | 639 | for (var i = 0; i < subpath.getNumAnchors(); i++) { |