diff options
author | Valerio Virgillito | 2012-07-24 16:05:35 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-24 16:05:35 -0700 |
commit | cf92eba275d544170942351f14eebaf4cd1bfb05 (patch) | |
tree | fd0b8b47a967392e070f0512eee478cbf1f80011 /js | |
parent | d587635bc41169507a85cb088ab2c9b2dcd44af1 (diff) | |
parent | d1afab5dab2a22a5dd578c646165a88fa37422ed (diff) | |
download | ninja-cf92eba275d544170942351f14eebaf4cd1bfb05.tar.gz |
Merge branch 'IKNinja_1980' of https://github.com/mqg734/ninja
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 34 |
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); |