1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
var Montage = require("montage/core/core").Montage,
Component = require("montage/ui/component").Component;
exports.BindingPanel = Montage.create(Component, {
bindings : { value: null },
editView : { value: null },
_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.editView.bindingArgs = bindingArgs;
this.editing = true;
}
},
/* -------------------------
Toolbar Button Actions
------------------------- */
handleAddAction : {
value: function(e) {
var newBindingArgs = {
sourceObject : this.application.ninja.objectsController.currentObject
};
this.displayEditView(newBindingArgs);
}
},
templateDidLoad : {
value: function() {
Object.defineBinding(this, 'bindings', {
boundObject: this.application.ninja.objectsController,
boundObjectPropertyPath: "currentObjectBindings",
oneway: true
});
}
},
willDraw: {
value: function() {
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)');
this.editView.element.style.setProperty('box-shadow', '0 0 10px rgba(0,0,0,0.2)')
} else {
this.editView.element.style.removeProperty(transStr);
this.editView.element.style.removeProperty('box-shadow');
}
}
}
});
|