forked from jakesgordon/javascript-tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapCodeView.js
More file actions
27 lines (27 loc) · 764 Bytes
/
MapCodeView.js
File metadata and controls
27 lines (27 loc) · 764 Bytes
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
var MapCodeView = Backbone.View.extend({
tagName: "textarea",
initialize: function () {
_.bindAll(this, "render","setBounds","setCode","getCode");
this.model.bind("change:mapcode", this.render);
this.model.bind("change:rows change:cols", this.setBounds);
this.render();
},
setBounds: function() {
//console.log("Bounds");
this.$el.attr({
"rows": this.model.get("rows")+1,
"cols": this.model.get("cols")+1
})
;
},
setCode: function() {
this.$el.val(this.model.get("mapcode"));
},
getCode: function() {
return this.$el.val();
},
render: function () {
this.setBounds();
this.setCode();
}
})