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
|
var Montage = require("montage/core/core").Montage,
Component = require("montage/ui/component").Component;
exports.BindingPanel = Montage.create(Component, {
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', {
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)');
} else {
this.editView.element.style.removeProperty(transStr);
}
}
}
});
|