From f57727d36709bbda03b45788dc12faf31a591b40 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 24 Apr 2012 08:28:39 -0700 Subject: re-compute and store the center of the subpath in local coordinates upon file open --- js/lib/geom/sub-path.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/lib') diff --git a/js/lib/geom/sub-path.js b/js/lib/geom/sub-path.js index 43420bc9..56c94df3 100755 --- a/js/lib/geom/sub-path.js +++ b/js/lib/geom/sub-path.js @@ -1106,6 +1106,14 @@ GLSubpath.prototype.importJSON = function(jo) { this._fillColor = jo.fillColor; this._dirty = true; + this.createSamples(false); + this.offsetPerBBoxMin(); + + //compute and store the center of the bbox in local space + var bboxMin = this.getBBoxMin(); + var bboxMax = this.getBBoxMax(); + var bboxMid = [0.5*(bboxMin[0]+bboxMax[0]),0.5*(bboxMin[1]+bboxMax[1]),0.5*(bboxMin[2]+bboxMax[2])]; + this.setCanvasCenterLocalCoord(bboxMid); }; GLSubpath.prototype.import = function( importStr ) { -- cgit v1.2.3