aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js4
-rwxr-xr-xjs/data/menu-data.js9
-rwxr-xr-xjs/document/html-document.js45
-rwxr-xr-xjs/helper-classes/3D/view-utils.js42
-rwxr-xr-xjs/mediators/keyboard-mediator.js6
-rwxr-xr-xjs/models/app-model.js12
-rwxr-xr-xjs/ninja.reel/ninja.js7
-rwxr-xr-xjs/stage/stage.reel/stage.html2
-rwxr-xr-xjs/stage/stage.reel/stage.js11
9 files changed, 109 insertions, 29 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index df3c74f8..57289448 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -59,10 +59,12 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
59 this.eventManager.addEventListener("executeNewFile", this, false); 59 this.eventManager.addEventListener("executeNewFile", this, false);
60 this.eventManager.addEventListener("executeSave", this, false); 60 this.eventManager.addEventListener("executeSave", this, false);
61 61
62 this.eventManager.addEventListener("recordStyleChanged", this, false); 62 this.eventManager.addEventListener("recordStyleChanged", this, false);
63
63 } 64 }
64 }, 65 },
65 66
67
66 68
67 handleWebRequest: { 69 handleWebRequest: {
68 value: function (request) { 70 value: function (request) {
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index 6503e776..7c3ca5d4 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -140,6 +140,15 @@ exports.MenuData = Montage.create( Montage, {
140 } 140 }
141 }, 141 },
142 { 142 {
143 "displayText" : "Chrome Preview",
144 "hasSubMenu" : false,
145 "enabled": true,
146 "checked": {
147 "value": false,
148 "boundProperty": "chromePreview"
149 }
150 },
151 {
143 "displayText" : "Layout View", 152 "displayText" : "Layout View",
144 "hasSubMenu" : false, 153 "hasSubMenu" : false,
145 "enabled": true, 154 "enabled": true,
diff --git a/js/document/html-document.js b/js/document/html-document.js
index ae2b4600..77cc711d 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -363,6 +363,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
363 // 363 //
364 handleEvent: { 364 handleEvent: {
365 value: function(event){ 365 value: function(event){
366 //TODO: Remove
367 window.hackPreview = this.livePreview.bind(this);
368
366 this.application.ninja.documentController._hackRootFlag = true; 369 this.application.ninja.documentController._hackRootFlag = true;
367 //console.log(this._userDocument.root, this); 370 //console.log(this._userDocument.root, this);
368 //TODO: Clean up, using for prototyping save 371 //TODO: Clean up, using for prototyping save
@@ -471,6 +474,48 @@ exports.HTMLDocument = Montage.create(TextDocument, {
471 } 474 }
472 }, 475 },
473 476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499 ////////////////////////////////////////////////////////////////////
500 //
501 livePreview: {
502 enumerable: false,
503 value: function () {
504 //this.application.ninja.documentController
505 //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]);
506 chrome.tabs.create({url: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]});
507 }
508 },
509 ////////////////////////////////////////////////////////////////////
510
511
512
513
514
515
516
517
518
474 //////////////////////////////////////////////////////////////////// 519 ////////////////////////////////////////////////////////////////////
475 // 520 //
476 save: { 521 save: {
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index c8e20def..a2fac34f 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -4,16 +4,16 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, 7var Montage = require("montage/core/core").Montage,
8 snapManagerModule = require("js/helper-classes/3D/snap-manager"), 8 Component = require("montage/ui/component").Component,
9 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
9 Rectangle = require("js/helper-classes/3D/rectangle").Rectangle, 10 Rectangle = require("js/helper-classes/3D/rectangle").Rectangle,
10 ElementsMediator = require("js/mediators/element-mediator").ElementMediator; 11 ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
11/////////////////////////////////////////////////////////////////////// 12///////////////////////////////////////////////////////////////////////
12// Class ViewUtils 13// Class ViewUtils
13// Viewing Utility functions 14// Viewing Utility functions
14/////////////////////////////////////////////////////////////////////// 15///////////////////////////////////////////////////////////////////////
15var ViewUtils = exports.ViewUtils = Object.create(Object.prototype, 16exports.ViewUtils = Montage.create(Component, {
16{
17 /////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////
18 // Instance variables 18 // Instance variables
19 /////////////////////////////////////////////////////////////////////// 19 ///////////////////////////////////////////////////////////////////////
@@ -133,7 +133,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
133 var xVec = [mat[0], mat[1], mat[2], mat[3]]; 133 var xVec = [mat[0], mat[1], mat[2], mat[3]];
134 var yVec = [mat[4], mat[5], mat[6], mat[7]]; 134 var yVec = [mat[4], mat[5], mat[6], mat[7]];
135 135
136 var stage = snapManagerModule.SnapManager.getStage(); 136 var stage = this.application.ninja.currentDocument.documentRoot;
137 var stageMat = this.getMatrixFromElement(stage); 137 var stageMat = this.getMatrixFromElement(stage);
138 var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; 138 var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]];
139 139
@@ -412,7 +412,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
412 // get the four corners of the element in global space 412 // get the four corners of the element in global space
413 var bounds = this.getElementViewBounds3D( elt ); 413 var bounds = this.getElementViewBounds3D( elt );
414 var bounds3D = new Array(); 414 var bounds3D = new Array();
415 var stage = snapManagerModule.SnapManager.getStage(); 415 var stage = this.application.ninja.currentDocument.documentRoot;
416 for (var i=0; i<3; i++) 416 for (var i=0; i<3; i++)
417 { 417 {
418 var gPt = this.localToGlobal( bounds[i], elt ); 418 var gPt = this.localToGlobal( bounds[i], elt );
@@ -789,7 +789,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
789 789
790 getStageWorldToGlobalMatrix: { 790 getStageWorldToGlobalMatrix: {
791 value: function() { 791 value: function() {
792 var stage = snapManagerModule.SnapManager.getStage(); 792 var stage = this.application.ninja.currentDocument.documentRoot;
793 this.pushViewportObj( stage ); 793 this.pushViewportObj( stage );
794 794
795 // get the matrix to the parent 795 // get the matrix to the parent
@@ -1190,12 +1190,7 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
1190// drawLayoutModule.drawLayout.redrawDocument() OR 1190// drawLayoutModule.drawLayout.redrawDocument() OR
1191// window.stageManager.drawSelectionRec(true) this.getStage().draw(); 1191// window.stageManager.drawSelectionRec(true) this.getStage().draw();
1192// drawLayoutModule.drawLayout.redrawDocument(); 1192// drawLayoutModule.drawLayout.redrawDocument();
1193// 1193
1194// SNAP MANAGER
1195// snapManager: snapManagerModule.SnapManager
1196// snapManagerModule: snapManagerModule = r_equire("js/helper-classes/3D/snap-manager")
1197// stage stage = snapManagerModule.SnapManager.getStage();
1198//
1199// SELECTION MANAGER 1194// SELECTION MANAGER
1200// selected elements: this.application.ninja.selectedElements 1195// selected elements: this.application.ninja.selectedElements
1201// selectionManager this.application.ninja.selectionController 1196// selectionManager this.application.ninja.selectionController
@@ -1213,10 +1208,10 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
1213 1208
1214 clearStageTranslation: { 1209 clearStageTranslation: {
1215 value: function() { 1210 value: function() {
1216 if (snapManagerModule.SnapManager.application.ninja.currentDocument) 1211 if (this.application.ninja.currentDocument)
1217 { 1212 {
1218 // get the user content object 1213 // get the user content object
1219 var userContent = snapManagerModule.SnapManager.application.ninja.currentDocument.documentRoot; 1214 var userContent = this.application.ninja.currentDocument.documentRoot;
1220 if (!userContent) return; 1215 if (!userContent) return;
1221 this.setViewportObj( userContent ); 1216 this.setViewportObj( userContent );
1222 1217
@@ -1235,9 +1230,10 @@ var ViewUtils = exports.ViewUtils = Object.create(Object.prototype,
1235 value:function( globalPt, zoomFactor ) { 1230 value:function( globalPt, zoomFactor ) {
1236 var localPt; 1231 var localPt;
1237 var tmp1, tmp2, tmp3; 1232 var tmp1, tmp2, tmp3;
1238 if (snapManagerModule.SnapManager.application.ninja.currentDocument) 1233
1234 if (this.application.ninja.currentDocument)
1239 { 1235 {
1240 var userContent = snapManagerModule.SnapManager.application.ninja.currentDocument.documentRoot; 1236 var userContent = this.application.ninja.currentDocument.documentRoot;
1241 if (!userContent) return;