From a5387d3cc74350dd06ecab2c8524d63d7540e57f Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 4 Jun 2012 16:37:09 -0700 Subject: Binding Panel - Add edit view --- js/panels/binding-panel.reel/binding-panel.css | 4 + js/panels/binding-panel.reel/binding-panel.html | 12 ++- js/panels/binding-panel.reel/binding-panel.js | 44 ++++++++- .../binding/binding-item.reel/binding-item.html | 1 + .../binding/binding-item.reel/binding-item.js | 6 ++ .../edit-binding-view.reel/edit-binding-view.css | 36 +++++++ .../edit-binding-view.reel/edit-binding-view.html | 103 +++++++++++++++++++++ .../edit-binding-view.reel/edit-binding-view.js | 21 +++++ 8 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 js/panels/binding/edit-binding-view.reel/edit-binding-view.css create mode 100644 js/panels/binding/edit-binding-view.reel/edit-binding-view.html create mode 100644 js/panels/binding/edit-binding-view.reel/edit-binding-view.js diff --git a/js/panels/binding-panel.reel/binding-panel.css b/js/panels/binding-panel.reel/binding-panel.css index f29b66c1..e3dcf140 100644 --- a/js/panels/binding-panel.reel/binding-panel.css +++ b/js/panels/binding-panel.reel/binding-panel.css @@ -4,6 +4,10 @@ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ +.binding-panel { + position: relative; + height: 100%; +} .bindings-list { padding: 0; diff --git a/js/panels/binding-panel.reel/binding-panel.html b/js/panels/binding-panel.reel/binding-panel.html index 2850b67c..a926da8d 100644 --- a/js/panels/binding-panel.reel/binding-panel.html +++ b/js/panels/binding-panel.reel/binding-panel.html @@ -13,7 +13,8 @@ "owner": { "prototype": "js/panels/binding-panel.reel", "properties": { - "element": {"#": "binding"} + "element": {"#": "binding"}, + "editView": {"@": "editBinding"} } }, "arrayController": { @@ -41,16 +42,23 @@ "boundObject": {"<-": "@repetition.objectAtCurrentIteration.boundObject"}, "oneway": {"<-": "@repetition.objectAtCurrentIteration.oneway"} } + }, + "editBinding": { + "prototype": "js/panels/binding/edit-binding-view.reel", + "properties": { + "element": {"#": "edit-binding-view" } + } } } -
+
+
\ No newline at end of file diff --git a/js/panels/binding-panel.reel/binding-panel.js b/js/panels/binding-panel.reel/binding-panel.js index 9fdec416..c2ce556c 100644 --- a/js/panels/binding-panel.reel/binding-panel.js +++ b/js/panels/binding-panel.reel/binding-panel.js @@ -4,10 +4,34 @@ var Montage = require("montage/core/core").Montage, exports.BindingPanel = Montage.create(Component, { - bindings : { + bindings : { value: null }, + editView : { value: null }, + editingClass : { value: 'editing-binding' }, + _editing: { value: null }, + editing: { + get: function() { + return this._editing; + }, + set: function(value) { + if(value === this._editing) { return; } + this._editing = value; + this.needsDraw = true; + } + }, + _translateDistance : { value: null }, + displayEditView : { + value: function(bindingArgs) { + this.editing = true; + } + }, + + /* ------------------------- + Draw Cycle + ------------------------- */ + templateDidLoad : { value: function() { Object.defineBinding(this, 'bindings', { @@ -18,9 +42,23 @@ exports.BindingPanel = Montage.create(Component, { } }, - prepareForDraw: { + willDraw: { value: function() { - console.log("test- objects"); + if(this.editing) { + this._translateDistance = this.element.offsetWidth; + } + } + }, + + draw : { + value: function() { + var transStr = '-webkit-transform'; + + if(this.editing) { + this.editView.element.style.setProperty(transStr, 'translate3d(-'+ this._translateDistance + 'px,0,0)'); + } else { + this.editView.element.style.removeProperty(transStr); + } } } }); \ No newline at end of file diff --git a/js/panels/binding/binding-item.reel/binding-item.html b/js/panels/binding/binding-item.reel/binding-item.html index 79644a7a..95a349f8 100644 --- a/js/panels/binding/binding-item.reel/binding-item.html +++ b/js/panels/binding/binding-item.reel/binding-item.html @@ -14,6 +14,7 @@ "prototype": "js/panels/binding/binding-item.reel", "properties": { "element": {"#": "binding-item"}, + "editButton": {"@": "editButton" }, "directionToggleButton": {"@": "directionToggleButton" } } }, diff --git a/js/panels/binding/binding-item.reel/binding-item.js b/js/panels/binding/binding-item.reel/binding-item.js index 0fc06ea8..294e8d35 100644 --- a/js/panels/binding/binding-item.reel/binding-item.js +++ b/js/panels/binding/binding-item.reel/binding-item.js @@ -82,6 +82,12 @@ exports.BindingItem = Montage.create(Component, { } }, + handleEditButtonAction : { + value: function(e) { + this.parentComponent.parentComponent.displayEditView(); + } + }, + /* -------------- Component Draw Cycle -------------- */ templateDidLoad : { diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.css b/js/panels/binding/edit-binding-view.reel/edit-binding-view.css new file mode 100644 index 00000000..b0249c6c --- /dev/null +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.css @@ -0,0 +1,36 @@ +/* + 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. +
*/ + +.edit-binding-view { + background: #474747; + color: #FFF; + font-size: 11px; + height: 100%; + /*left: 100%;*/ + /*position: absolute;*/ + /*top: 0;*/ + width: 100%; + -webkit-transition: -webkit-transform 140ms ease-in; +} + +.edit-binding-view ul { + padding: 0; + margin: 0; +} + +.edit-binding-view li { + padding: 3px; + list-style-type: none; +} + +/* hintable fields */ + +.so-pp, .bo-pp { + border: 1px solid #313131; + padding: 1px 4px; + background-color: #444; + margin-left: 5px; +} \ No newline at end of file diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.html b/js/panels/binding/edit-binding-view.reel/edit-binding-view.html new file mode 100644 index 00000000..1d502a3e --- /dev/null +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.html @@ -0,0 +1,103 @@ + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js new file mode 100644 index 00000000..700f3024 --- /dev/null +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -0,0 +1,21 @@ +/* + 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; + + +exports.EditBindingView = Montage.create(Component, { + objectsList : { + value: ["Object1", "Object2", "Object3"] + }, + + prepareForDraw : { + value: function() { + console.log("Preparing to draw edit view"); + } + } +}); \ No newline at end of file -- cgit v1.2.3