# HG changeset patch # User Thinker K.F. Li # Date 1282012596 -28800 # Node ID 299ed9319dc61258b5178b50f18761c6e46f11ab # Parent a843f147c9951bf7f8489380929be456bd84b417 Use key symbols instead of keycodes. diff -r a843f147c995 -r 299ed9319dc6 nodejs/mbapp.js --- a/nodejs/mbapp.js Tue Aug 17 08:31:24 2010 +0800 +++ b/nodejs/mbapp.js Tue Aug 17 10:36:36 2010 +0800 @@ -32,8 +32,8 @@ exports.app=app; // Put all key definition here -exports.KEY_UP = 111; -exports.KEY_DOWN=116; +exports.KEY_UP = 0xff52; +exports.KEY_DOWN = 0xff54; exports.EVT_ANY=0; exports.EVT_MOUSE_OVER=1; exports.EVT_MOUSE_OUT=2; diff -r a843f147c995 -r 299ed9319dc6 nodejs/testsvg.js --- a/nodejs/testsvg.js Tue Aug 17 08:31:24 2010 +0800 +++ b/nodejs/testsvg.js Tue Aug 17 10:36:36 2010 +0800 @@ -10,7 +10,7 @@ lightbar[5] = app.get("item"+item)[5]; app.addKeyboardListener(mbapp.EVT_KB_PRESS, function(evt) { - if (evt.keycode == mbapp.KEY_UP) { + if (evt.sym == mbapp.KEY_UP) { item = item - 1; if (item == 0) item = 1; else { @@ -18,7 +18,7 @@ var an = new animate.linear(app,lightbar,target[2],target[5],0.3); an.start(); } - } else if (evt.keycode == mbapp.KEY_DOWN) { + } else if (evt.sym == mbapp.KEY_DOWN) { item = item + 1; if (item == 10) { item = 9;