From 725bb869618b9e0ebb2820a24bca5d1cf53a4810 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 15 Mar 2012 15:14:28 -0700 Subject: Initial Data Binding Mediator Signed-off-by: Armen Kesablyan --- js/mediators/binding-mediator.js | 14 ++++++++++++++ js/mediators/keyboard-mediator.js | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 js/mediators/binding-mediator.js (limited to 'js') diff --git a/js/mediators/binding-mediator.js b/js/mediators/binding-mediator.js new file mode 100644 index 00000000..10d3f7c6 --- /dev/null +++ b/js/mediators/binding-mediator.js @@ -0,0 +1,14 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage; +var Component = require("montage/ui/component").Component; + +exports.bindingMediator = Montage.create(Component, { + + + +}); \ No newline at end of file diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 65dd34cd..85a46739 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -203,6 +203,8 @@ exports.KeyboardMediator = Montage.create(Component, { } + + if((evt.keyCode == Keyboard.ENTER) && (evt.ctrlKey || evt.metaKey)) { this.application.ninja.executeChromePreview(); return; -- cgit v1.2.3 From 9b8a24a7360416d5750828c9580e33dd336ff882 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Fri, 16 Mar 2012 17:57:18 -0700 Subject: Getting ownerComponent bindings --- .../templates/montage-html/main.reel/main.js | 43 +++++++++++----------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'js') diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index 567f481c..ee23e844 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js @@ -17,7 +17,25 @@ exports.Main = Montage.create(Component, { */ templateDidLoad: { value: function(){ - window.addComponent = this.addComponentToUserDocument; + var self = this; + window.addComponent = function(element, data, callback) { + var component; + + component = require.async(data.path) + .then(function(component) { + var componentRequire = component[data.name]; + var componentInstance = componentRequire.create(); + + componentInstance.element = element; + //componentInstance.deserializedFromTemplate(); + componentInstance.needsDraw = true; + componentInstance.ownerComponent = self; + + callback(componentInstance, element); + }) + .end(); + + }; // window.addBinding = this.addBindingToUserDocument; // Dispatch event when this template has loaded. @@ -29,26 +47,9 @@ exports.Main = Montage.create(Component, { } }, - // Adding components to the user document by using a async require. - addComponentToUserDocument:{ - value:function(element, data, callback){ - - var component; - - component = require.async(data.path) - .then(function(component) { - var componentRequire = component[data.name]; - var componentInstance = componentRequire.create(); - - componentInstance.element = element; - //componentInstance.deserializedFromTemplate(); - componentInstance.needsDraw = true; - - callback(componentInstance, element); - }) - .end(); - - } + location: { + value:null, + enumerable:false } }); \ No newline at end of file -- cgit v1.2.3 From 9b53d2dac464cb9217b217e6707dbb97c1d65490 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 11:25:52 -0700 Subject: Deleting unecessary property --- js/document/templates/montage-html/main.reel/main.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'js') diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index ee23e844..6c141108 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js @@ -45,11 +45,5 @@ exports.Main = Montage.create(Component, { document.body.dispatchEvent( newEvent ); } - }, - - location: { - value:null, - enumerable:false } - }); \ No newline at end of file -- cgit v1.2.3 From 14f28d0031dc9d522b4ae7d1dbff192b8d8a670e Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 11:58:58 -0700 Subject: Adding components to PI --- .../ComponentsPanelBase.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index b4eec771..981e666f 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -22,6 +22,26 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component value: { "text": "styles", "children": [ + { + "text": "Widgets", + "children": [ + { + "text": "Map", + "dataFile" : "node_modules/components-data/map.json", + "component": "map" + }, + { + "text": "Feed Reader", + "dataFile" : "node_modules/components-data/feed-reader.json", + "component": "feedreader" + }, + { + "text": "Search Bar", + "dataFile" : "node_modules/components-data/searchfield.json", + "component": "searchfield" + } + ] + }, { "text": "Montage Components", "children": [ @@ -50,7 +70,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component "dataFile" : "node_modules/components-data/number-input.json", "component": "numberInput" }, - { + { "text": "Select Input", "dataFile" : "node_modules/components-data/select.json", "component": "select" -- cgit v1.2.3 From 9c7f7c69495175a4a5a093aeb78f078d0cb7835d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 16 Mar 2012 17:14:54 -0700 Subject: Fixed snap-manager to stop snapping after first level children. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/snap-manager.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 1caacd00..a755e9e2 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -471,7 +471,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { value: function( plane ) { this._elementCache = new Array; - var stage = this.getStage(); +// var stage = this.getStage(); + var stage = this.application.ninja.currentSelectedContainer || this.getStage(); this.hLoadElementCache( stage, plane, 0 ); this._isCacheInvalid = false; @@ -570,6 +571,11 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { hLoadElementCache : { value: function( elt, plane, depth ) { + if(depth > 1) + { + return; + } + if (depth > 0) { // check if the element is on the specified plane @@ -590,8 +596,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { elt.elementModel.isIn2DSnapCache = false; } - // TODO - Don't traverse components' children -// if(elt.elementModel && elt.elementModel.isComponent) + // TODO - Don't traverse svg and components' children if(elt.nodeName.toLowerCase() === "svg" || (elt.elementModel && (elt.elementModel.isComponent || (elt.elementModel.selection === "SVG")))) { return; @@ -964,7 +969,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { snapToElements : { value: function( screenPt, hitRecs ) { // start at the stage. - var stage = this.getStage(); +// var stage = this.getStage(); + var stage = this.application.ninja.currentSelectedContainer || this.getStage(); // the root should be the 'view' canvas, so the first matrix is the camera viewUtils.setViewportObj( stage ); @@ -980,6 +986,10 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { { value: function( elt, hitRecs, depth, globalScrPt ) { + if(depth > 1) + { + return; + } // hit test the current object var hit; if (depth > 0) // don't snap to the root @@ -1001,8 +1011,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } } - // TODO - Don't traverse components' children -// if(elt.elementModel && elt.elementModel.isComponent) + // TODO - Don't traverse svg and components' children if(elt.nodeName.toLowerCase() === "svg" || (elt.elementModel && (elt.elementModel.isComponent || (elt.elementModel.selection === "SVG")))) { return; -- cgit v1.2.3 From 11afad994a9ff5e3c8c43d8ad9cd2cf7d0147797 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sat, 17 Mar 2012 15:38:29 -0700 Subject: adding element creation for the map and feedreader components. Signed-off-by: Valerio Virgillito --- .../ComponentsPanelBase.reel/ComponentsPanelBase.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js') diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 981e666f..92d21bc3 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -333,6 +333,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component el.setAttribute("type", "range"); break; case "textfield": + case "searchfield": el = NJUtils.makeNJElement("input", "Textfield", "component"); el.elementModel.pi = "TextfieldPi"; el.setAttribute("type", "text"); @@ -346,6 +347,16 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component el.elementModel.pi = "ToggleButtonPi"; el.innerHTML = "Off"; break; + case "map": + el = NJUtils.makeNJElement("div", "Map", "component"); + el.elementModel.pi = "MapPi"; + el.elementModel.isComponent = true; + break; + case "feedreader": + el = NJUtils.makeNJElement("div", "Feed Reader", "component"); + el.elementModel.pi = "FeedReaderPi"; + el.elementModel.isComponent = true; + } return el; -- cgit v1.2.3 From bcddcf118d4ce93e8a2519ed455c6e25a701ce74 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sat, 17 Mar 2012 16:42:13 -0700 Subject: fixing the map styles and temporary disabling the 3d styles for elements. Signed-off-by: Valerio Virgillito --- js/controllers/elements/element-controller.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 70aba54e..efaa00ee 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -290,10 +290,10 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, value: function(el, props, index, update3DModel) { var dist = props[index]["dist"], mat = props[index]["mat"]; - this.application.ninja.stylesController.setElementStyle(el, - "-webkit-transform", - "perspective(" + dist + ") " + - "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); +// this.application.ninja.stylesController.setElementStyle(el, +// "-webkit-transform", +// "perspective(" + dist + ") " + +// "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); el.elementModel.props3D.matrix3d = mat; el.elementModel.props3D.perspectiveDist = dist; -- cgit v1.2.3 From a086ca62423a09807e2f3a79107249bc31d5e908 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sat, 17 Mar 2012 18:41:17 -0700 Subject: Adding back webkit-transform styles in set3DProperties. Changing "zoom" to "zoomValue" in map component to avoid scaling the map. Signed-off-by: Nivesh Rajbhandari Signed-off-by: Valerio Virgillito --- js/controllers/elements/element-controller.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index efaa00ee..70aba54e 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -290,10 +290,10 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, value: function(el, props, index, update3DModel) { var dist = props[index]["dist"], mat = props[index]["mat"]; -// this.application.ninja.stylesController.setElementStyle(el, -// "-webkit-transform", -// "perspective(" + dist + ") " + -// "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); + this.application.ninja.stylesController.setElementStyle(el, + "-webkit-transform", + "perspective(" + dist + ") " + + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); el.elementModel.props3D.matrix3d = mat; el.elementModel.props3D.perspectiveDist = dist; -- cgit v1.2.3 From 09852e9b9b8e64f003bed5aa57630d8b42c8ac95 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 19:28:30 -0700 Subject: Integrating picasa carousel and youtube channel --- .../ComponentsPanelBase.reel/ComponentsPanelBase.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 92d21bc3..49d1179a 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -25,20 +25,30 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component { "text": "Widgets", "children": [ + { + "text": "Feed Reader", + "dataFile" : "node_modules/components-data/feed-reader.json", + "component": "feedreader" + }, { "text": "Map", "dataFile" : "node_modules/components-data/map.json", "component": "map" }, { - "text": "Feed Reader", - "dataFile" : "node_modules/components-data/feed-reader.json", - "component": "feedreader" + "text": "Picasa Carousel", + "dataFile" : "node_modules/components-data/picasa-carousel.json", + "component": "picasa-carousel" }, { "text": "Search Bar", "dataFile" : "node_modules/components-data/searchfield.json", "component": "searchfield" + }, + { + "text": "Youtube Channel", + "dataFile" : "node_modules/components-data/youtube-channel.json", + "component": "youtube-channel" } ] }, -- cgit v1.2.3 From 6b1467535198f6b85bd2bf045d2c354b812616c2 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 20:03:18 -0700 Subject: Youtube video is droppable still getting errors with the carousel Signed-off-by: Valerio Virgillito --- .../ComponentsPanelBase.reel/ComponentsPanelBase.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js') diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 49d1179a..dcb69255 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -366,6 +366,17 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component el = NJUtils.makeNJElement("div", "Feed Reader", "component"); el.elementModel.pi = "FeedReaderPi"; el.elementModel.isComponent = true; + break; + case "picasa-carousel": + el = NJUtils.makeNJElement("div", "Picasa Carousel", "component"); + el.elementModel.pi = "PicasaCarouselPi"; + el.elementModel.isComponent = true; + break; + case "youtube-channel": + el = NJUtils.makeNJElement("div", "Youtube Channel", "component"); + el.elementModel.pi = "YoutubeChannelPi"; + el.elementModel.isComponent = true; + break; } -- cgit v1.2.3 From fda7b595c96d99177fdd93de8da9030348a3f8fb Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 18 Mar 2012 12:34:29 -0700 Subject: Temp I/O functionality for M-JS components Added the ability to save montages component serialization from Ninja. Very rough, but functional. --- js/document/html-document.js | 4 +-- js/io/system/ninjalibrary.json | 4 +-- js/mediators/io-mediator.js | 70 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 69 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/document/html-document.js b/js/document/html-document.js index d4db6e2f..be1f89e2 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -905,7 +905,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { } } } - return {mode: 'html', document: this._userDocument, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; + return {mode: 'html', document: this._userDocument, mjs: this._userComponents, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; } else if (this.currentView === "code"){ //TODO: Would this get call when we are in code of HTML? } else { @@ -928,7 +928,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { } } } - return {mode: 'html', document: this._userDocument, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; + return {mode: 'html', document: this._userDocument, mjs: this._userComponents, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; } else if (this.currentView === "code"){ //TODO: Would this get call when we are in code of HTML? } else { diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json index 00ee7ed2..42505e38 100644 --- a/js/io/system/ninjalibrary.json +++ b/js/io/system/ninjalibrary.json @@ -1,6 +1,6 @@ { "libraries": [ - {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"}, - {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.1.0"} + {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.7.0.0"}, + {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.1.1"} ] } \ No newline at end of file diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index d81f4543..01879bac 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -6,10 +6,11 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot //////////////////////////////////////////////////////////////////////// // -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component, - FileIo = require("js/io/system/fileio").FileIo, - ProjectIo = require("js/io/system/projectio").ProjectIo; +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, + FileIo = require("js/io/system/fileio").FileIo, + ProjectIo = require("js/io/system/projectio").ProjectIo, + TemplateCreator = require("node_modules/tools/template-creator").TemplateCreator; //////////////////////////////////////////////////////////////////////// // exports.IoMediator = Montage.create(Component, { @@ -369,7 +370,7 @@ exports.IoMediator = Montage.create(Component, { } } // - var json, matchingtags = [], webgltag, scripts = template.document.content.document.getElementsByTagName('script'), webgljstag, webgllibtag, webglrdgetag; + var json, matchingtags = [], webgltag, scripts = template.document.content.document.getElementsByTagName('script'), webgljstag, webgllibtag, webglrdgetag, mjstag, mjslibtag; // for (var i in scripts) { if (scripts[i].getAttribute) { @@ -385,6 +386,12 @@ exports.IoMediator = Montage.create(Component, { if (scripts[i].getAttribute('data-ninja-webgl-rdge') !== null) { webglrdgetag = scripts[i]; // TODO: Add logic to delete unneccesary tags } + if (scripts[i].getAttribute('type') !== 'text/montage-serialization') { + mjstag = scripts[i]; // TODO: Add logic to delete unneccesary tags + } + if (scripts[i].getAttribute('data-mjs-lib') !== null) { + mjslibtag = scripts[i]; // TODO: Add logic to delete unneccesary tags + } } } // @@ -451,6 +458,59 @@ function loadWebGL (e) {\n\ //Setting string in tag webgltag.innerHTML = json; } + + + + + // + var mjsCounter = 0, mjsComponents = [], temp = TemplateCreator.create(); + for (var m in template.mjs) { + mjsComponents.push(template.mjs[m]); + mjsCounter++; + } + +// console.log(mjsComponents); + + //console.log(TemplateCreator.) + + if (template.mjs && mjsCounter > 0) { + var mjsDirName, mjsVersion, + mjscode = temp.initWithHeadAndBodyElements(template.document.content.document.documentElement.head, template.document.content.document.documentElement.body, mjsComponents)._ownerSerialization; + //Copy Montage library if needed + for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) { + //Checking for Montage library to be available + if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Montage') { + mjsDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); + mjsVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; + this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, mjsDirName); + //TODO: Fix to allow no overwrite + var packjson = this.application.ninja.coreIoApi.createFile({uri: template.document.root+'package.json', contents: '{"mappings": {"montage": "'+mjsDirName+'/"}}'}); + } else { + //TODO: Error handle no available library to copy + } + } + // + if (!mjslibtag) { + mjslibtag = template.document.content.document.createElement('script'); + mjslibtag.setAttribute('type', 'text/javascript'); + mjslibtag.setAttribute('src', mjsDirName+'/montage.js'); + mjslibtag.setAttribute('data-mjs-lib', 'true'); + template.document.content.document.head.appendChild(mjslibtag); + } + // + if (!mjstag) { + mjstag = template.document.content.document.createElement('script'); + mjstag.setAttribute('type', 'text/montage-serialization'); + template.document.content.document.head.appendChild(mjstag); + } + // + mjstag.innerHTML = mjscode; + } + + + + + //Cleaning URLs from HTML var cleanHTML = template.document.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this)); // -- cgit v1.2.3 From 3056d540f32bb24927d06bfc516240cc6a0001f8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sun, 18 Mar 2012 15:13:25 -0700 Subject: looping through both branches of the components tree Signed-off-by: Valerio Virgillito --- .../ComponentsPanelBase.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index dcb69255..87c68a52 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -159,15 +159,19 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component _loadComponents: { value: function() { - this.componentsToLoad = this.components.children[0].children.length; - - for(var i = 0, component; component = this.components.children[0].children[i]; i++) { - var req = new XMLHttpRequest(); - //req.identifier = "searchRequest"; - req.open("GET", component.dataFile); - req.addEventListener("load", this, false); - req.addEventListener("error", this, false); - req.send(); + for(var cat in this.components.children) { + + this.componentsToLoad += this.components.children[cat].children.length; + + for(var i = 0, component; component = this.components.children[cat].children[i]; i++) { + var req = new XMLHttpRequest(); + //req.identifier = "searchRequest"; + req.open("GET", component.dataFile); + req.addEventListener("load", this, false); + req.addEventListener("error", this, false); + req.send(); + } + } } }, -- cgit v1.2.3 From 9cb68d376870eea3db3636c30e5fa09d9f71c8cf Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 18 Mar 2012 18:07:40 -0700 Subject: Tests and clean-up --- js/mediators/io-mediator.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 01879bac..18a517a5 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -462,17 +462,17 @@ function loadWebGL (e) {\n\ + + + // var mjsCounter = 0, mjsComponents = [], temp = TemplateCreator.create(); + // for (var m in template.mjs) { mjsComponents.push(template.mjs[m]); mjsCounter++; } - -// console.log(mjsComponents); - - //console.log(TemplateCreator.) - + // if (template.mjs && mjsCounter > 0) { var mjsDirName, mjsVersion, mjscode = temp.initWithHeadAndBodyElements(template.document.content.document.documentElement.head, template.document.content.document.documentElement.body, mjsComponents)._ownerSerialization; @@ -483,7 +483,7 @@ function loadWebGL (e) {\n\ mjsDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name+this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); mjsVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.document.root, mjsDirName); - //TODO: Fix to allow no overwrite + //TODO: Fix to allow no overwrite and nested locations var packjson = this.application.ninja.coreIoApi.createFile({uri: template.document.root+'package.json', contents: '{"mappings": {"montage": "'+mjsDirName+'/"}}'}); } else { //TODO: Error handle no available library to copy @@ -511,6 +511,8 @@ function loadWebGL (e) {\n\ + + //Cleaning URLs from HTML var cleanHTML = template.document.content.document.documentElement.outerHTML.replace(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi, parseNinjaRootUrl.bind(this)); // -- cgit v1.2.3 From 44d75ed17d56055ed9dbb8f91867bbdbc68924fa Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sun, 18 Mar 2012 22:21:14 -0700 Subject: fixing the selection of components. Temporary workaround for now. Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 13 ++++++++----- js/controllers/selection-controller.js | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 83450d0f..260ee8a0 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -11,6 +11,8 @@ exports.ComponentController = Montage.create(ElementController, { getProperty: { value: function(el, prop) { + var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); + switch(prop) { case "id": case "class": @@ -19,18 +21,20 @@ exports.ComponentController = Montage.create(ElementController, { case "width": case "height": if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { - return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + return component[prop]; } else { return ElementController.getProperty(el, prop, true); } default: - return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + return component[prop]; } } }, setProperty: { value: function(el, p, value) { + var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); + switch(p) { case "id": case "class": @@ -39,15 +43,14 @@ exports.ComponentController = Montage.create(ElementController, { case "width": case "height": if(el.nodeName === "IMG" && (p === "width" || p === "height")) { - this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + component[p] = value; } else { ElementController.setProperty(el, p, value); } break; default: if(p === "min" || p === "max") value = parseFloat(value); - - this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + component[p] = value; break; } diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 154fb7f8..fa82d4cc 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; + Component = require("montage/ui/component").Component, + NJUtils = require("js/lib/NJUtils").NJUtils; exports.SelectionController = Montage.create(Component, { @@ -154,6 +155,28 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = true; } + if(item && item.controller && !item.elementModel.isComponent) { + var componentInfo = Montage.getInfoForObject(item.controller); + var componentName = componentInfo.objectName.toLowerCase(); + switch(componentName) { + case "feedreader": + NJUtils.makeElementModel(item, "Feed Reader", "component", false); + item.elementModel.pi = "FeedReaderPi"; + item.elementModel.isComponent = true; + break; + case "map": + NJUtils.makeElementModel(item, "Map", "component", false); + item.elementModel.pi = "MapPi"; + item.elementModel.isComponent = true; + break; + case "youtubechannel": + NJUtils.makeElementModel(item, "Youtube Channel", "component", false); + item.elementModel.pi = "YoutubeChannelPi"; + item.elementModel.isComponent = true; + break; + } + } + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } -- cgit v1.2.3 From ea439c4471948cb7e1dbb98bfa9c2ddc374d48e7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 19 Mar 2012 14:19:48 -0700 Subject: Maps - Apply default width and height styles to components if specified. Change default location to Sunnyvale. Signed-off-by: Nivesh Rajbhandari --- .../Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'js') diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 87c68a52..599eeda3 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js @@ -291,6 +291,13 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' }; + var defaultStyles = component.defaultStyles; + if(defaultStyles) { + for(var n in defaultStyles) { + styles[n] = defaultStyles[n]; + } + } + that.application.ninja.currentDocument.setComponentInstance(instance, element); NJevent("elementAdding", {"el": element, "data":styles}); -- cgit v1.2.3 From f9e31800b1dedd7904e6e23c575c94ed4a72abdb Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 19 Mar 2012 15:23:08 -0700 Subject: fixing the selection for the picasa carousel Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index fa82d4cc..5091f99a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -174,6 +174,11 @@ exports.SelectionController = Montage.create(Component, { item.elementModel.pi = "YoutubeChannelPi"; item.elementModel.isComponent = true; break; + case "picasacarousel": + NJUtils.makeElementModel(item, "Picasa Carousel", "component", false); + item.elementModel.pi = "PicasaCarouselPi"; + item.elementModel.isComponent = true; + break; } } -- cgit v1.2.3 From 313354a8ff9ed21b826ab5f280bcf1095a64a7f4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 19 Mar 2012 18:11:50 -0700 Subject: fully removing our old button component from Ninja Signed-off-by: Valerio Virgillito --- js/components/button.reel/button.css | 40 ---- js/components/button.reel/button.html | 26 --- js/components/button.reel/button.js | 225 --------------------- .../text-properties.reel/text-properties.html | 2 +- js/panels/properties.reel/properties.css | 13 -- .../position-and-size.reel/position-and-size.css | 32 ++- .../position-and-size.reel/position-and-size.html | 13 +- .../position-and-size.reel/position-and-size.js | 10 +- 8 files changed, 41 insertions(+), 320 deletions(-) delete mode 100755 js/components/button.reel/button.css delete mode 100755 js/components/button.reel/button.html delete mode 100755 js/components/button.reel/button.js (limited to 'js') diff --git a/js/components/button.reel/button.css b/js/components/button.reel/button.css deleted file mode 100755 index f50a9873..00000000 --- a/js/components/button.reel/button.css +++ /dev/null @@ -1,40 +0,0 @@ -/* - This file contains proprietary software owned by Motorola Mobility, Inc.
- No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
- (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -.button { - border:none; - cursor:default; - text-align:center; - -webkit-user-select:none; - opacity:0.8; - display:table-cell; - vertical-align:middle; - width:100%; - height:100%; - background-color:#333333; - color:white; -} - -.button:hover -{ - opacity:1; -} - -.button:active -{ - outline:solid 1px black; -} - -.button.on -{ - background-color: #333333; -} - -.button.off -{ - background-color: #cccccc; - color:black; -} \ No newline at end of file diff --git a/js/components/button.reel/button.html b/js/components/button.reel/button.html deleted file mode 100755 index d0398a6a..00000000 --- a/js/components/button.reel/button.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/js/components/button.reel/button.js b/js/components/button.reel/button.js deleted file mode 100755 index 2d26c8b4..00000000 --- a/js/components/button.reel/button.js +++ /dev/null @@ -1,225 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage, -Component = require("montage/ui/component").Component; - -var Button = exports.Button = Montage.create(Component, { - // Button state - _focused: { - value: false - }, - - _pressed: { - value: false - }, - - _isToggleButton: { - value: false - }, - - isToggleButton: { - serializable: true, - enumerable: true, - get: function() { - return this._isToggleButton; - }, - set: function(value) { - if (value !== this._isToggleButton) { - this._isToggleButton = value; - this.needsDraw = true; - } - } - }, - - _value: { - value: false - }, - - value: { - serializable: true, - enumerable: true, - get: function() { - return this._value; - }, - set: function(value) { - if ( (value !== null) && (value !== this._value) ) { - this._value = value; - this.needsDraw = true; - } - } - }, - - _label: { - value: "" - }, - - label: { - serializable: true, - enumerable: true, - get: function() { - return this._label; - }, - set: function(value) { - if (value !== this._label) { - this._label = value; - this.needsDraw = true; - } - } - }, - - // TODO - Allow user to specify up, over and down states - _onState: { - value: "on" - }, - - onState: { - serializable: true, - enumerable: true, - get: function() { - return this._onState; - }, - set: function(value) { - if (value !== this._onState) { - this._onState = value; - this.needsDraw = true; - } - } - }, - - _offState: { - value: "off" - }, - - offState: { - serializable: true, - enumerable: true, - get: function() { - return this._offState; - }, - set: function(value) { - if (value !== this._offState) { - this._offState = value; - this.needsDraw = true; - } - } - }, - - // Low-level event listeners - handleTouchstart: { - value: function(event) { - // TODO preventingDefault disables the magnifying class - // sadly it also disables double tapping on the button to zoom... - event.preventDefault(); - this._acknowledgeIntent(); - } - }, - - handleMousedown: { - value: function(event) { - this._acknowledgeIntent(); - } - }, - - handleTouchend: { - value: function(event) { - this._interpretInteraction(event); - } - }, - - handleTouchcancel: { - value: function(event) { - console.log("cancel!") - // this._interpretInteraction(event); - } - }, - - handleMouseup: { - value: function(event) { - this._interpretInteraction(event); - } - }, - - // Internal state management - _acknowledgeIntent: { - value: function() { - this._pressed = true; - this.element.classList.add("pressed"); - } - }, - - _interpretInteraction: { - value: function(event) { - - if (!this._pressed) { - return; - } - - this.value = !this.value; - - this._pressed = false; - this._dispatchActionEvent(); - } - }, - - _dispatchActionEvent: { - value: function() { - var actionEvent = document.createEvent("CustomEvent"); - actionEvent.initCustomEvent("action", true, true); - actionEvent.type = "action"; - this.dispatchEvent(actionEvent); - } - }, - - draw: { - enumerable: false, - value: function() { - if(this.isToggleButton) - { - if(this._value === true) - { - this.element.classList.remove(this.offState); - this.element.classList.add(this.onState); - } - else - { - this.element.classList.remove(this.onState); - this.element.classList.add(this.offState); - } - } - - if(this.label && this.label !== "") - { - this.element.textContent = this.label; - } - } - }, - - prepareForDraw: { - value: function() { - - // TODO only install low level event listeners for high level - // events others listen to us for - - this.element.addEventListener("touchstart", this); - // TODO listen to mouseup anywhere within the app - document.addEventListener("touchend", this); - document.addEventListener("touchcancel", this); - - - this.element.addEventListener("mousedown", this); - - // TODO listen to mouseup anywhere within the app - document.addEventListener("mouseup", this); - - // TODO accept space or enter as a way to trigger action - // if element targeted; balancing demans of multitouch - // with traditional single focus model - document.addEventListener("keydown", this, true); - } - } - -}); diff --git a/js/components/tools-properties/text-properties.reel/text-properties.html b/js/components/tools-properties/text-properties.reel/text-properties.html index 13a88ba7..2d50a79e 100755 --- a/js/components/tools-properties/text-properties.reel/text-properties.html +++ b/js/components/tools-properties/text-properties.reel/text-properties.html @@ -69,7 +69,7 @@ }, "fontSettings": { - "module": "js/components/button.reel", + "module": "montage/ui/button.reel", "name": "Button", "properties": { "element": {"#": "fontSettings"} diff --git a/js/panels/properties.reel/properties.css b/js/panels/properties.reel/properties.css index f8d37984..f82d3660 100755 --- a/js/panels/properties.reel/properties.css +++ b/js/panels/properties.reel/properties.css @@ -230,23 +230,10 @@ padding-right:6px; clear:none; } -.propertiesPanel .LockToolUp, .propertiesPanel .UnLockToolUp { - position: absolute; - left: 105px; - border: none; - background-color: transparent; - top: 2px; - opacity: 0.7; -} - .propertiesPanel .button:active { outline: none; } -.propertiesPanel .LockToolUp:hover, .propertiesPanel .UnLockToolUp:hover { - opacity: 1; -} - .propertiesPanel input[type="checkbox"].nj-skinned, .propertiesPanel input[type="radio"].nj-skinned { position: relative; overflow: visible; diff --git a/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.css b/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.css index 227a232b..7f8fdbc2 100755 --- a/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.css +++ b/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.css @@ -8,7 +8,33 @@ display: none; } -.fieldCol .disabled -{ +.fieldCol .disabled { color:#999999; -} \ No newline at end of file +} + + +#posBound { + position: absolute; + left: 105px; + border: none; + background-color: transparent; + top: 2px; + opacity: 0.7; + width: 17px; + height: 18px; + margin-right: 10px; +} + +#posBound:hover { + opacity: 1; +} + +.unlock{ + background: url("../../../../../images/optionsbar/unlinked.png") no-repeat; + +} + +.lockUp { + background: url("../../../../../images/optionsbar/link.png") no-repeat; +} + diff --git a/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.html b/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.html index 6e355f31..f50724c5 100755 --- a/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.html +++ b/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.html @@ -85,13 +85,12 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot } }, "bindButton": { - "module": "js/components/button.reel", - "name": "Button", + "prototype": "montage/ui/toggle-button.reel", "properties": { - "element": {"#" :"posBound"}, - "isToggleButton": true, - "onState": "LockToolUp", - "offState": "UnLockToolUp" + "element": {"#": "posBound"}, + "pressedClass": "lockUp", + "preventFocus": true, + "identifier": "ratio" } } } @@ -119,7 +118,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
- +
diff --git a/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.js b/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.js index 49117090..1e47916f 100755 --- a/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.js +++ b/js/panels/properties.reel/sections/position-and-size.reel/position-and-size.js @@ -100,7 +100,7 @@ exports.PosSize = Montage.create(Component, { */ handleRatioAction: { value: function() { - if(this.bindButton.value) { + if(this.bindButton.pressed) { this.aspectRatioWidth = this.heightControl.value / this.widthControl.value; if(isNaN(this.aspectRatioWidth) || !isFinite(this.aspectRatioWidth) || this.aspectRatioWidth === 0) this.aspectRatioWidth = 1; @@ -148,7 +148,7 @@ exports.PosSize = Montage.create(Component, { this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - if(this.bindButton.value) { + if(this.bindButton.pressed) { var newWidth = Math.round(this.aspectRatioHeight * this.heightControl.value); @@ -173,7 +173,7 @@ exports.PosSize = Montage.create(Component, { this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - if(this.bindButton.value) { + if(this.bindButton.pressed) { var newHeight = Math.round(this.aspectRatioWidth * this.widthControl.value); @@ -221,7 +221,7 @@ exports.PosSize = Montage.create(Component, { this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - if(this.bindButton.value) { + if(this.bindButton.pressed) { var newWidth = Math.round(this.aspectRatioHeight * this.heightControl.value); @@ -246,7 +246,7 @@ exports.PosSize = Montage.create(Component, { this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - if(this.bindButton.value) { + if(this.bindButton.pressed) { var newHeight = Math.round(this.aspectRatioWidth * this.widthControl.value); if(!isFinite(newHeight)) newHeight = this.widthControl.value; -- cgit v1.2.3 From 24fd82f555d0e3e591acceb0322bc514b87e95fb Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 20 Mar 2012 14:15:34 -0700 Subject: Presets - Animation update --- js/panels/presets/default-animation-presets.js | 79 ++++++++++++++++++++------ 1 file changed, 62 insertions(+), 17 deletions(-) (limited to 'js') diff --git a/js/panels/presets/default-animation-presets.js b/js/panels/presets/default-animation-presets.js index 10a3e906..2e656e86 100644 --- a/js/panels/presets/default-animation-presets.js +++ b/js/panels/presets/default-animation-presets.js @@ -18,23 +18,23 @@ exports.animationPresets = { "-webkit-animation": "border-morph 2s infinite" } }, - { - "isKeyFrameRule": true, - "keys" : [{ - "keyText": "0%", - "styles": { "border-radius": "0" } - }, { - "keyText": "50%", - "styles": { - "border-radius": "100%" - } - }, { - "keyText": "100%", - "styles": { - "border-radius": "0%" - } + { + "isKeyFrameRule": true, + "keys" : [{ + "keyText": "0%", + "styles": { "border-radius": "0" } + }, { + "keyText": "50%", + "styles": { + "border-radius": "100%" + } + }, { + "keyText": "100%", + "styles": { + "border-radius": "0%" + } + }] }] - }] }] }, { "text": "3D Animations", @@ -50,7 +50,7 @@ exports.animationPresets = { "-webkit-animation-iteration-count": "infinite", "-webkit-animation-direction": "normal", "-webkit-animation-timing-function": "ease-out", - "-webkit-transform-origin": "200% 50%", + "-webkit-transform-origin": "100% 50%", "-webkit-transform-style": "preserve-3d", "-webkit-transform": "perspective(1000)", "-webkit-animation-delay": "0s" @@ -89,6 +89,51 @@ exports.animationPresets = { } }] }] + }, + { + "text": "Rotate with Fade In", + "selectorBase" : "rotate-with-fade-in", + "rules" : [{ + "selectorSuffix" : "", + "styles" : { + "-webkit-animation-name": "rotate-with-fade-in", + "-webkit-animation-duration": "5s", + "-webkit-animation-iteration-count": "infinite", + "-webkit-animation-direction": "normal", + "-webkit-animation-timing-function": "ease-out", + "-webkit-transform-origin": "100% 50%", + "-webkit-transform-style": "preserve-3d", + "-webkit-transform": "perspective(1000)", + "-webkit-animation-delay": "0s" + } + },{ + "isKeyFrameRule": true, + "keys" : [{ + "keyText": "0%", + "styles": { + "opacity": "0", + "-webkit-transform": "perspective(1000) rotateY(-90deg)" + } + }, { + "keyText": "15%", + "styles": { + "opacity": "1", + "-webkit-transform": "perspective(1000) rotateY(0deg)" + } + }, { + "keyText": "85%", + "styles": { + "opacity": "1", + "-webkit-transform": "perspective(1000) rotateY(0deg)" + } + }, { + "keyText": "100%", + "styles": { + "opacity": "0", + "-webkit-transform": "perspective(1000) rotateY(95deg)" + } + }] + }] }] }] }; \ No newline at end of file -- cgit v1.2.3 From c0a1164b5e84098e005f076de5eddd0e60387286 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 20 Mar 2012 14:21:29 -0700 Subject: Fixing the selection issues Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 27 --------------------------- js/lib/NJUtils.js | 32 +++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 28 deletions(-) (limited to 'js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 5091f99a..9b0e638a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -155,33 +155,6 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = true; } - if(item && item.controller && !item.elementModel.isComponent) { - var componentInfo = Montage.getInfoForObject(item.controller); - var componentName = componentInfo.objectName.toLowerCase(); - switch(componentName) { - case "feedreader": - NJUtils.makeElementModel(item, "Feed Reader", "component", false); - item.elementModel.pi = "FeedReaderPi"; - item.elementModel.isComponent = true; - break; - case "map": - NJUtils.makeElementModel(item, "Map", "component", false); - item.elementModel.pi = "MapPi"; - item.elementModel.isComponent = true; - break; - case "youtubechannel": - NJUtils.makeElementModel(item, "Youtube Channel", "component", false); - item.elementModel.pi = "YoutubeChannelPi"; - item.elementModel.isComponent = true; - break; - case "picasacarousel": - NJUtils.makeElementModel(item, "Picasa Carousel", "component", false); - item.elementModel.pi = "PicasaCarouselPi"; - item.elementModel.isComponent = true; - break; - } - } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 4f1082f9..904aa41e 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -96,15 +96,45 @@ exports.NJUtils = Object.create(Object.prototype, { value: function(el, selection, controller, isShape) { var p3d = Montage.create(Properties3D).init(el); var shapeProps = null; + var pi = controller + "Pi"; + if(isShape) { shapeProps = Montage.create(ShapeModel); } + if(el.controller) { + + var componentInfo = Montage.getInfoForObject(el.controller); + var componentName = componentInfo.objectName.toLowerCase(); + + controller = "component"; + isShape = false; + + switch(componentName) { + case "feedreader": + selection = "Feed Reader"; + pi = "FeedReaderPi"; + break; + case "map": + selection = "Map"; + pi = "MapPi"; + break; + case "youtubechannel": + selection = "Youtube Channel"; + pi = "YoutubeChannelPi"; + break; + case "picasacarousel": + selection = "Picasa Carousel"; + pi = "PicasaCarouselPi"; + break; + } + } + el.elementModel = Montage.create(ElementModel, { type: { value: el.nodeName}, selection: { value: selection}, controller: { value: ControllerFactory.getController(controller)}, - pi: { value: controller + "Pi"}, + pi: { value: pi}, props3D: { value: p3d}, shapeModel: { value: shapeProps} }); -- cgit v1.2.3 From fa3ebf391db168d7c4ebcc86450c66684eeeb5cd Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 21 Mar 2012 11:11:5