Mercurial > MadButterfly
annotate nodejs/phone.js @ 796:0b1764cd53b0
Fix missed naming for variables
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 31 Aug 2010 10:13:03 +0800 |
parents | 46a4cd4d382b |
children | 891bbaca1d8f |
rev | line source |
---|---|
794 | 1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- |
789 | 2 // vim: sw=4:ts=8:sts=4:ai |
3 var mbapp = require("./mbapp"); | |
4 var sys=require("sys"); | |
5 var animate=require("./animate"); | |
6 | |
7 app = new mbapp.app(":0.0", 320, 480); | |
8 app.loadSVG("phone_ui.svg"); | |
9 | |
10 var icons = []; | |
11 var r, c; | |
12 var mbname; | |
13 | |
796
0b1764cd53b0
Fix missed naming for variables
Thinker K.F. Li <thinker@codemud.net>
parents:
795
diff
changeset
|
14 for(c = 0; c < 4; c++) { // 4 columns |
0b1764cd53b0
Fix missed naming for variables
Thinker K.F. Li <thinker@codemud.net>
parents:
795
diff
changeset
|
15 for(r = 0; r < 5; r++) { // 5 rows |
0b1764cd53b0
Fix missed naming for variables
Thinker K.F. Li <thinker@codemud.net>
parents:
795
diff
changeset
|
16 mbname = "icon" + c + "" + r; |
789 | 17 icons.push(app.get(mbname)); |
18 } | |
19 } | |
20 | |
21 var overhint, presshint; | |
22 var overholder, pressholder; | |
23 overhint = app.get("overhint"); | |
24 presshint = app.get("presshint"); | |
25 overholder = new animate.holder(app, overhint); | |
26 pressholder = new animate.holder(app, presshint); | |
27 | |
28 var dock; | |
29 var dockholder; | |
30 dock = app.get("dock"); | |
31 dockholder = new animate.holder(app, dock); | |
32 | |
33 var i; | |
34 var icon; | |
35 for(i = 0; i < icons.length; i++) { | |
36 icon = icons[i]; | |
37 icon.mouse_event.add_event_observer(1, function(evt) { | |
792
bf2794eed702
Remove redundant code
Thinker K.F. Li <thinker@codemud.net>
parents:
791
diff
changeset
|
38 overholder.go_center(evt.cur_tgt); |
789 | 39 }); |
40 icon.mouse_event.add_event_observer(2, function(evt) { | |
41 overholder.home(); | |
42 }); | |
43 icon.mouse_event.add_event_observer(4, function(evt) { | |
792
bf2794eed702
Remove redundant code
Thinker K.F. Li <thinker@codemud.net>
parents:
791
diff
changeset
|
44 pressholder.go_center(evt.cur_tgt); |
789 | 45 }); |
46 } | |
47 | |
48 var sw = 0; | |
793 | 49 var dock_up = new animate.linear(app, dock, 0, -300, 0.5); |
795
46a4cd4d382b
Remove dependent on system time to gain frame rate
Thinker K.F. Li <thinker@codemud.net>
parents:
794
diff
changeset
|
50 var dock_down = new animate.linear(app, dock, 0, 0, 0.2); |
789 | 51 dock.mouse_event.add_event_observer(4, function(evt) { |
791
85c5949352bb
Slide the dock of phone UI
Thinker K.F. Li <thinker@codemud.net>
parents:
789
diff
changeset
|
52 if(sw == 0) { |
793 | 53 dock_up.start(); |
791
85c5949352bb
Slide the dock of phone UI
Thinker K.F. Li <thinker@codemud.net>
parents:
789
diff
changeset
|
54 } else { |
793 | 55 dock_down.start(); |
791
85c5949352bb
Slide the dock of phone UI
Thinker K.F. Li <thinker@codemud.net>
parents:
789
diff
changeset
|
56 } |
793 | 57 sw = sw ^ 1; |
789 | 58 }); |
59 | |
60 app.loop(); |