diff options
author | Pushkar Joshi | 2012-04-03 11:13:07 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-04-03 11:13:07 -0700 |
commit | 06970d710f7172ee5ab736ef082c7703c61bfd0c (patch) | |
tree | ac3daf4accc7b257c19b662ae6c0bfe0b97114ef /js/tools | |
parent | c838f85d28acbf2fe208a4358aef9cac73b65fbc (diff) | |
download | ninja-06970d710f7172ee5ab736ef082c7703c61bfd0c.tar.gz |
track the canvas top left position instead of the center position to figure out when to translate the subpath per canvas translation...this one seems to not drift (no floating point issues uncovered so far)
Diffstat (limited to 'js/tools')
-rwxr-xr-x | js/tools/PenTool.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 0dbefd16..91b7606e 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js | |||
@@ -419,10 +419,6 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
419 | bboxMax = this._selectedSubpath.getBBoxMax(); | 419 | bboxMax = this._selectedSubpath.getBBoxMax(); |
420 | var bboxMid = [0.5 * (bboxMax[0] + bboxMin[0]), 0.5 * (bboxMax[1] + bboxMin[1]), 0.5 * (bboxMax[2] + bboxMin[2])]; | 420 | var bboxMid = [0.5 * (bboxMax[0] + bboxMin[0]), 0.5 * (bboxMax[1] + bboxMin[1]), 0.5 * (bboxMax[2] + bboxMin[2])]; |
421 | 421 | ||
422 | this._selectedSubpath.setPlaneCenter(bboxMid); | ||
423 | this._selectedSubpath.setCanvasX(bboxMid[0]); | ||
424 | this._selectedSubpath.setCanvasY(bboxMid[1]); | ||
425 | |||
426 | //call render shape with the bbox width and height | 422 | //call render shape with the bbox width and height |
427 | this.RenderShape(bboxWidth, bboxHeight, bboxMid, this._penPlaneMat, this._penCanvas); | 423 | this.RenderShape(bboxWidth, bboxHeight, bboxMid, this._penPlaneMat, this._penCanvas); |
428 | } | 424 | } |
@@ -437,6 +433,9 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
437 | 433 | ||
438 | var left = Math.round(midPt[0] - 0.5 * w); | 434 | var left = Math.round(midPt[0] - 0.5 * w); |
439 | var top = Math.round(midPt[1] - 0.5 * h); | 435 | var top = Math.round(midPt[1] - 0.5 * h); |
436 | this._selectedSubpath.setPlaneCenter(midPt); | ||
437 | this._selectedSubpath.setCanvasLeft(left); | ||
438 | this._selectedSubpath.setCanvasTop(top); | ||
440 | 439 | ||
441 | if (!canvas) { | 440 | if (!canvas) { |
442 | var newCanvas = null; | 441 | var newCanvas = null; |