aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/mediators/drag-drop-mediator.js11
-rwxr-xr-xjs/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js2
-rw-r--r--js/panels/presets/animations-presets.reel/animations-presets.css5
-rw-r--r--js/panels/presets/animations-presets.reel/animations-presets.html59
-rw-r--r--js/panels/presets/animations-presets.reel/animations-presets.js73
-rw-r--r--js/panels/presets/content.reel/content.html12
-rw-r--r--js/panels/presets/default-animation-presets.js94
-rwxr-xr-xjs/stage/stage.reel/stage.js30
-rwxr-xr-xjs/tools/SelectionTool.js5
-rwxr-xr-xjs/tools/Translate3DToolBase.js111
-rwxr-xr-xjs/tools/TranslateObject3DTool.js40
-rwxr-xr-xjs/tools/drawing-tool.js2
-rwxr-xr-xjs/tools/modifier-tool-base.js25
13 files changed, 411 insertions, 58 deletions
diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js
index 3a965be5..8663b06e 100755
--- a/js/mediators/drag-drop-mediator.js
+++ b/js/mediators/drag-drop-mediator.js
@@ -60,6 +60,17 @@ exports.DragDropMediator = Montage.create(Component, {
60 var i, files = e.dataTransfer.files, position = {x: e.offsetX, y: e.offsetY}, 60 var i, files = e.dataTransfer.files, position = {x: e.offsetX, y: e.offsetY},
61 rootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), 61 rootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])),
62 rootUri = this.application.ninja.documentController.documentHackReference.root; 62 rootUri = this.application.ninja.documentController.documentHackReference.root;
63
64 var xferString = e.dataTransfer.getData("text/plain");
65 if(xferString) {
66 // If the drop is a component, call the delegate with the top,left coordinates
67 if(xferString.indexOf("componentDrop") > -1) {
68 if(this.dropDelegate && typeof this.dropDelegate === 'object') {
69 this.dropDelegate.handleComponentDrop(e.offsetX - this.application.ninja.stage.userContentLeft, e.offsetY - this.application.ninja.stage.userContentTop);
70 return;
71 }
72 }
73 }
63 // 74 //
64 for (i=0; files[i]; i++) { 75 for (i=0; files[i]; i++) {
65 if (files[i].type.indexOf('image') !== -1) { 76 if (files[i].type.indexOf('image') !== -1) {
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index b6bee37d..b4eec771 100755
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -118,7 +118,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
118 didCreate: { 118 didCreate: {
119 value: function() { 119 value: function() {
120 // Setup the drop delegate 120 // Setup the drop delegate
121// this.application.ninja.dragDropMediator.dropDelegate = this; 121 this.application.ninja.dragDropMediator.dropDelegate = this;
122 // Loop through the component and load the JSON data for them 122 // Loop through the component and load the JSON data for them
123 this._loadComponents(); 123 this._loadComponents();
124 } 124 }
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.css b/js/panels/presets/animations-presets.reel/animations-presets.css
new file mode 100644
index 00000000..0441c1cf
--- /dev/null
+++ b/js/panels/presets/animations-presets.reel/animations-presets.css
@@ -0,0 +1,5 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */ \ No newline at end of file
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.html b/js/panels/presets/animations-presets.reel/animations-presets.html
new file mode 100644
index 00000000..c9d752af
--- /dev/null
+++ b/js/panels/presets/animations-presets.reel/animations-presets.html
@@ -0,0 +1,59 @@
1<!DOCTYPE html>
2<!-- <copyright>
3This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
4No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
5(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
6</copyright> -->
7<html lang="en">
8<head>
9 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
10 <link rel="stylesheet" href="animations-presets.css" type="text/css">
11 <script type="text/montage-serialization">
12 {
13 "owner": {
14 "module" : "js/panels/presets/animations-presets.reel",
15 "name" : "AnimationsLibrary",
16 "properties" : {
17 "element" : {"#" : "animationsLibrary"},
18 "treeList" : {"@" : "treeList"}
19 }
20 },
21 "presetsController" : {
22 "module": "js/controllers/tree-controller",
23 "name": "TreeController",
24 "properties" : {
25 "branchKey" : "children",
26 "labelKey" : "text",
27 "delegate": {"@": "owner" }
28 },
29 "bindings": {
30 "content": {
31 "boundObject": {"@": "owner"},
32 "boundObjectPropertyPath": "presetData"
33 }
34 }
35 },
36 "presetsContainer" : {
37 "module" : "js/components/treeview/treeview.reel",
38 "name" : "Treeview",
39 "properties" : {
40 "element" : {"#": "libraryContainer"},
41 "branchComponent" : {"@": "branch" },
42 "contentController": {"@": "presetsController"},
43 "activationEvent" : "dblclick",
44 "showRoot": false
45 }
46 },
47 "branch" : {
48 "module" : "js/components/treeview/ninja-branch.reel",
49 "name" : "Branch"
50 }
51 }
52 </script>
53</head>
54<body>
55<section id="animationsLibrary" class="animationsLibrary">
56 <div id="libraryContainer"></div>
57</section>
58</body>
59</html> \ No newline at end of file
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.js b/js/panels/presets/animations-presets.reel/animations-presets.js
new file mode 100644
index 00000000..ab200212
--- /dev/null
+++ b/js/panels/presets/animations-presets.reel/animations-presets.js
@@ -0,0 +1,73 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 DefaultPresets = require("js/panels/presets/default-animation-presets").animationPresets;
10
11exports.AnimationsLibrary = Montage.create(Component, {
12 hasTemplate: {
13 value: true
14 },
15 presetData : {
16 value: null
17 },
18 deserializedFromTemplate : {
19 value: function() {
20 this.presetData = DefaultPresets;
21 }
22 },
23 handleNodeActivation: {
24 value: function(presetData) {
25 //debugger;
26 var selection = this.application.ninja.selectedElements,
27 stylesController = this.application.ninja.stylesController,
28 selectorBase = presetData.selectorBase,
29 self = this;
30
31 if(!selection || !selection.length || selection.length === 0) {
32 return false;
33 }
34
35 selectorBase = stylesController.generateClassName(selectorBase);
36
37 presetData.rules.forEach(function(rule) {
38 if(rule.isKeyFrameRule) {
39 this.application.ninja.stylesController.addRule(
40 '@-webkit-keyframes ' + presetData.selectorBase,
41 this.stringifyKeys(rule.keys)
42 );
43 } else {
44 this.application.ninja.stylesController.addRule('.' + selectorBase + rule.selectorSuffix, rule.styles);
45 }
46
47 }, this);
48
49 selection.forEach(function(el) {
50 el._element.classList.add(selectorBase);
51 }, this);
52
53 }
54 },
55
56 stringifyKeys : {
57 value: function(keysArray) {
58 var keysString = '';
59
60 keysArray.forEach(function(key) {
61 var styles = '', style;
62
63 for(style in key.styles) {
64 styles += style + ':' + key.styles[style] + '; ';
65 }
66
67 keysString += key.keyText + ' {' + styles + ' }';
68 });
69
70 return keysString;
71 }
72 }
73});
diff --git a/js/panels/presets/content.reel/content.html b/js/panels/presets/content.reel/content.html
index 38de2a6d..f01e6435 100644
--- a/js/panels/presets/content.reel/content.html
+++ b/js/panels/presets/content.reel/content.html
@@ -19,7 +19,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
19 "tabBar" : {"#": "tab-bar" }, 19 "tabBar" : {"#": "tab-bar" },
20 "tabs" : [ 20 "tabs" : [
21 {"key":"styles", "tab": {"#": "styles" }}, 21 {"key":"styles", "tab": {"#": "styles" }},
22 {"key":"transitions", "tab": {"#": "transitions" }} 22 {"key":"transitions", "tab": {"#": "transitions" }},
23 {"key":"animations", "tab": {"#": "animations" }}
23 ] 24 ]