aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-07-24 15:48:40 -0700
committerNivesh Rajbhandari2012-07-24 15:48:40 -0700
commitd1afab5dab2a22a5dd578c646165a88fa37422ed (patch)
tree6661565d2b8a4b4dd9679714801df6500a7a0483 /js/controllers/elements
parent98ff98171c1f4a551760a01109ce8f0a80f0c922 (diff)
downloadninja-d1afab5dab2a22a5dd578c646165a88fa37422ed.tar.gz
IKNinja-1980 - [Shape] changing the stroke size of the object doesn't update the bounding box selection.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js34
1 files changed, 19 insertions, 15 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 6dabff47..ad0f40a2 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -56,10 +56,11 @@ exports.ShapesController = Montage.create(CanvasController, {
56 { 56 {
57 // Changing stroke size should grow/shrink the shape from the center. 57 // Changing stroke size should grow/shrink the shape from the center.
58 var delta = ~~(val - el.elementModel.shapeModel.GLGeomObj.getStrokeWidth()), 58 var delta = ~~(val - el.elementModel.shapeModel.GLGeomObj.getStrokeWidth()),
59 l = this.application.ninja.elementMediator.getProperty(el, "left", parseInt), 59 ol = this.application.ninja.elementMediator.getProperty(el, "left", parseInt),
60 t = this.application.ninja.elementMediator.getProperty(el, "top", parseInt), 60 ot = this.application.ninja.elementMediator.getProperty(el, "top", parseInt),
61 w = this.application.ninja.elementMediator.getProperty(el, "width", parseInt), 61 ow = this.application.ninja.elementMediator.getProperty(el, "width", parseInt),
62 h = this.application.ninja.elementMediator.getProperty(el, "height", parseInt); 62 oh = this.application.ninja.elementMediator.getProperty(el, "height", parseInt),
63 l, t, w, h;
63 64
64 if(geomType === 3) 65 if(geomType === 3)
65 { 66 {
@@ -68,12 +69,12 @@ exports.ShapesController = Montage.create(CanvasController, {
68 if(slope === "horizontal") 69 if(slope === "horizontal")
69 { 70 {
70 h = Math.max(val, 1); 71 h = Math.max(val, 1);
71 t -= ~~(delta/2); 72 t = ot - ~~(delta/2);
72 } 73 }
73 else if(slope === "vertical") 74 else if(slope === "vertical")
74 { 75 {
75 w = Math.max(val, 1); 76 w = Math.max(val, 1);
76 l -= ~~(delta/2); 77 l = ol - ~~(delta/2);
77 } 78 }
78 else 79 else
79 { 80 {
@@ -85,10 +86,10 @@ exports.ShapesController = Montage.create(CanvasController, {
85 var dX = ~~(xAdj*2 - oldXAdj*2); 86 var dX = ~~(xAdj*2 - oldXAdj*2);
86 var dY = ~~(yAdj*2 - oldYAdj*2); 87 var dY = ~~(yAdj*2 - oldYAdj*2);
87 88
88 l -= dX; 89 l = ol - dX;
89 t -= dY; 90 t = ot - dY;
90 w += dX*2; 91 w = ow + dX*2;
91 h += dY*2; 92 h = oh + dY*2;
92 93
93 el.elementModel.shapeModel.GLGeomObj.setXAdj(xAdj); 94 el.elementModel.shapeModel.GLGeomObj.setXAdj(xAdj);
94 el.elementModel.shapeModel.GLGeomObj.setYAdj(yAdj); 95 el.elementModel.shapeModel.GLGeomObj.setYAdj(yAdj);
@@ -96,13 +97,16 @@ exports.ShapesController = Montage.create(CanvasController, {
96 } 97 }
97 else 98 else
98 { 99 {
99 l -= ~~(delta/2); 100 l = ol - ~~(delta/2);
100 t -= ~~(delta/2); 101 t = ot - ~~(delta/2);
101 w += delta; 102 w = ow + delta;
102 h += delta; 103 h = oh + delta;
103 } 104 }
104 105
105 this.application.ninja.elementMediator.setProperties([{element:el, properties:{left: l + "px", top: t + "px", width: w + "px", height:h + "px"}}], eventType, source); 106 this.application.ninja.elementMediator.setProperties([{element:el,
107 properties:{left: l + "px", top: t + "px", width: w + "px", height: h + "px"},
108 previousProperties:{left: ol + "px", top: ot + "px", width: ow + "px", height: oh + "px"}}],
109 eventType, source);
106 110
107 } 111 }
108 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val); 112 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val);