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
|
define.class('$ui/screen', function($ui$, view, $examples$components$staticmap$, map){
this.attributes = {
location: Config({type:String, flow:"in"}),
zoomLevel: Config({type:String, flow:"in"}),
zooml: Config({type:int, value:14})
};
this.bestZoom = function () {
var zl = this.zooml;
var zlf = parseFloat(this.zoomLevel);
if (zlf) {
zl = zlf * 21;
} else {
if (this.zoomLevel === 'up' || this.zoomLevel === 'left') {
zl++;
this.zoomLevel = undefined
} else if (this.zoomLevel === 'down' || this.zoomLevel === 'right') {
zl--;
this.zoomLevel = undefined
}
}
if (!zl) {
zl = 14;
}
if (zl < 0) {
zl = 0;
}
if (zl > 21) {
zl = 21;
}
this.zooml = Math.round(zl);
return this.zooml;
};
this.render = function(){
return map({width:400, height:400, location:this.location, mapzoom:this.bestZoom()})
}
});
|