aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorhwc4872012-04-19 13:01:43 -0700
committerhwc4872012-04-19 13:01:43 -0700
commite6a20fe64574763483dc602bd759278ccf5e5e68 (patch)
tree69defe7200206f0257fe90697136fadef59d521e /js/stage
parentae7eb87564632ce7c676bd728b8ff2710ff0bb83 (diff)
parent9284c19f076dec3b47ece7dc7bcd22d74e4246c3 (diff)
downloadninja-e6a20fe64574763483dc602bd759278ccf5e5e68.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts: js/lib/drawing/world.js js/lib/geom/geom-obj.js js/lib/rdge/materials/cloud-material.js js/lib/rdge/materials/deform-material.js js/lib/rdge/materials/flat-material.js js/lib/rdge/materials/material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/relief-tunnel-material.js js/lib/rdge/materials/square-tunnel-material.js js/lib/rdge/materials/star-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/tunnel-material.js js/lib/rdge/materials/twist-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/uber-material.js js/lib/rdge/materials/water-material.js js/lib/rdge/materials/z-invert-material.js
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/layout.js20
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js12
-rwxr-xr-xjs/stage/stage.reel/stage.js10
-rwxr-xr-xjs/stage/tool-handle.js7
4 files changed, 30 insertions, 19 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 6be2df1d..a096848e 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -53,12 +53,8 @@ exports.Layout = Montage.create(Component, {
53 this.ctx.lineWidth = this.ctxLineWidth; 53 this.ctx.lineWidth = this.ctxLineWidth;
54 this.ctx.fillStyle = this.drawFillColor; 54 this.ctx.fillStyle = this.drawFillColor;
55 55
56// this.eventManager.addEventListener("elementAdded", this, false);
57 this.eventManager.addEventListener("elementDeleted", this, false);
58
59 this.eventManager.addEventListener("selectionChange", this, false); 56 this.eventManager.addEventListener("selectionChange", this, false);
60 57 this.eventManager.addEventListener("elementsRemoved", this, false);
61 this.eventManager.addEventListener("deleteSelection", this, false);
62 } 58 }
63 }, 59 },
64 60
@@ -76,7 +72,7 @@ exports.Layout = Montage.create(Component, {
76 }, 72 },
77 73
78 // Redraw stage only once after all deletion is completed 74 // Redraw stage only once after all deletion is completed
79 handleDeleteSelection: { 75 handleElementsRemoved: {
80 value: function(event) { 76 value: function(event) {
81 this.draw(); 77 this.draw();
82 this.draw3DInfo(false); 78 this.draw3DInfo(false);
@@ -110,10 +106,8 @@ exports.Layout = Montage.create(Component, {
110 106
111 // Draw the non selected elements 107 // Draw the non selected elements
112 if(!event.detail.isDocument) { 108 if(!event.detail.isDocument) {
113 var tmp = event.detail.elements.map(function(element){ return element._element});
114
115 this.elementsToDraw = this.domTree.filter(function(value) { 109 this.elementsToDraw = this.domTree.filter(function(value) {
116 return (tmp.indexOf(value) === -1); 110 return (event.detail.elements.indexOf(value) === -1);
117 }); 111 });
118 } else { 112 } else {
119 this.elementsToDraw = Array.prototype.slice.call(this.domTree, 0); 113 this.elementsToDraw = Array.prototype.slice.call(this.domTree, 0);
@@ -162,7 +156,7 @@ exports.Layout = Montage.create(Component, {
162 drawTagOutline: { 156 drawTagOutline: {
163 value: function (item) { 157 value: function (item) {
164 158
165 if(!item) return; 159 if(!item || (item.nodeType !== 1)) return;
166 160
167 // TODO Bind the layoutview mode to the current document 161 // TODO Bind the layoutview mode to the current document
168 // var mode = this.application.ninja.currentDocument.layoutMode; 162 // var mode = this.application.ninja.currentDocument.layoutMode;
@@ -345,7 +339,11 @@ exports.Layout = Montage.create(Component, {
345 339
346 _elementName: { 340 _elementName: {
347 value: function(item) { 341 value: function(item) {
348 return this.application.ninja.elementMediator.getNJProperty(item, "selection"); 342 if(item.elementModel && item.elementModel.hasOwnProperty("selection")) {
343 return item.elementModel['selection'];
344 } else {
345 return "";
346 }
349 } 347 }
350 } 348 }
351 349
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index ad67cada..1f471431 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -200,14 +200,18 @@ exports.StageView = Montage.create(Component, {
200 }, 200 },
201 showRulers:{ 201 showRulers:{
202 value:function(){ 202 value:function(){
203 this.application.ninja.rulerTop.style.background = "url('../images/temp/ruler-top.png')"; 203 this.application.ninja.rulerTop.style.display = "block";
204 this.application.ninja.rulerLeft.style.background = "url('../images/temp/ruler-left.png')"; 204 this.application.ninja.rulerLeft.style.display = "block";
205// this.application.ninja.rulerTop.style.background = "url('../images/temp/ruler-top.png')";
206// this.application.ninja.rulerLeft.style.background = "url('../images/temp/ruler-left.png')";
205 } 207 }
206 }, 208 },
207 hideRulers:{ 209 hideRulers:{
208 value:function(){ 210 value:function(){
209 this.application.ninja.rulerTop.style.background = "rgb(128,128,128)"; 211 this.application.ninja.rulerTop.style.display = "none";
210 this.application.ninja.rulerLeft.style.background = "rgb(128,128,128)"; 212 this.application.ninja.rulerLeft.style.display = "none";
213// this.application.ninja.rulerTop.style.background = "rgb(128,128,128)";
214// this.application.ninja.rulerLeft.style.background = "rgb(128,128,128)";
211 } 215 }
212 }, 216 },
213 217
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 00b72490..ec8c0e55 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -560,8 +560,7 @@ exports.Stage = Montage.create(Component, {
560 elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); 560 elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop);
561 561
562 // workaround Chrome 3d bug 562 // workaround Chrome 3d bug
563 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(elt) !== -1) 563 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(elt) !== -1) {
564 {
565 return this._getElementUsingSnapping(point); 564 return this._getElementUsingSnapping(point);
566 } else { 565 } else {
567 return elt; 566 return elt;
@@ -605,7 +604,7 @@ exports.Stage = Montage.create(Component, {
605 var selArray = new Array(); 604 var selArray = new Array();
606 605
607 for(var i = 0; this.application.ninja.selectedElements[i];i++) { 606 for(var i = 0; this.application.ninja.selectedElements[i];i++) {
608 var curElement = this.application.ninja.selectedElements[i]._element; 607 var curElement = this.application.ninja.selectedElements[i];
609 608
610 // Add element to array that is used to calculate 3d-bounding box of all elements 609 // Add element to array that is used to calculate 3d-bounding box of all elements
611 selArray.push( curElement ); 610 selArray.push( curElement );
@@ -796,6 +795,8 @@ exports.Stage = Montage.create(Component, {
796 drawLine: { 795 drawLine: {
797 value:function(x0, y0, x1, y1, strokeSize, strokeColor) { 796 value:function(x0, y0, x1, y1, strokeSize, strokeColor) {
798 this.clearDrawingCanvas(); 797 this.clearDrawingCanvas();
798 var origStrokeStyle = this._drawingContext.strokeStyle;
799 var origLineWidth = this._drawingContext.lineWidth;
799 this._drawingContext.strokeStyle = strokeColor; 800 this._drawingContext.strokeStyle = strokeColor;
800 this._drawingContext.lineWidth = strokeSize; 801 this._drawingContext.lineWidth = strokeSize;
801 802
@@ -826,6 +827,9 @@ exports.Stage = Montage.create(Component, {
826 var w = Math.round(Math.abs(x1-x0)); 827 var w = Math.round(Math.abs(x1-x0));
827 this._drawingContext.fillText("H: " + h, txtX + 38, txtY - 4); 828 this._drawingContext.fillText("H: " + h, txtX + 38, txtY - 4);
828 this._drawingContext.fillText("W: " + w, txtX - 5, txtY + 12); 829 this._drawingContext.fillText("W: " + w, txtX - 5, txtY + 12);
830
831 this._drawingContext.strokeStyle = origStrokeStyle;
832 this._drawingContext.lineWidth = origLineWidth;
829 } 833 }
830 }, 834 },
831 835
diff --git a/js/stage/tool-handle.js b/js/stage/tool-handle.js
index f16d8324..d353da47 100755
--- a/js/stage/tool-handle.js
+++ b/js/stage/tool-handle.js
@@ -235,6 +235,8 @@ exports.RotateHandle = Montage.create(ToolHandle, {
235 context.strokeStyle = this._strokeStyle; 235 context.strokeStyle = this._strokeStyle;
236 context.fillStyle = this._fillStyle; 236 context.fillStyle = this._fillStyle;
237 context.lineWidth = this._lineWidth; 237 context.lineWidth = this._lineWidth;
238 context.shadowBlur = 2;
239 context.shadowColor = "rgba(0, 0, 0, 0.8)";
238 240
239 var pointOnElt = base.slice(0); 241 var pointOnElt = base.slice(0);
240// this._origin = viewUtils.localToGlobal(pointOnElt, item); 242// this._origin = viewUtils.localToGlobal(pointOnElt, item);
@@ -400,7 +402,8 @@ exports.RotateHandle = Montage.create(ToolHandle, {
400 var context = this.application.ninja.stage.drawingContext; 402 var context = this.application.ninja.stage.drawingContext;
401 context.save(); 403 context.save();
402 404
403 context.strokeStyle = this._strokeStyle; 405 context.strokeStyle = "rgba(0,0,0,1)";
406 context.lineWidth = 2;
404 context.fillStyle = this._fillStyle; 407 context.fillStyle = this._fillStyle;
405 context.globalAlpha = 0.2; 408 context.globalAlpha = 0.2;
406 409
@@ -574,6 +577,8 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
574 context.strokeStyle = this._strokeStyle; 577 context.strokeStyle = this._strokeStyle;
575 context.fillStyle = this._fillStyle; 578 context.fillStyle = this._fillStyle;
576 context.lineWidth = this._lineWidth; 579 context.lineWidth = this._lineWidth;
580 context.shadowBlur = 2;
581 context.shadowColor = "rgba(0, 0, 0, 0.8)";
577 582
578 var pointOnElt = base.slice(0); 583 var pointOnElt = base.slice(0);
579// this._origin = viewUtils.localToGlobal(pointOnElt, item); 584// this._origin = viewUtils.localToGlobal(pointOnElt, item);