fix bug with keyboard events

This commit is contained in:
rolux 2011-04-30 00:56:46 +02:00
parent 5f417fa152
commit 0211be527c
4 changed files with 15 additions and 14 deletions

View file

@ -125,7 +125,7 @@ Ox.load.UI = function(options, callback) {
} }
function showWarning() { function showWarning() {
Ox.print('showWarning') //Ox.print('showWarning')
var counter = 0, var counter = 0,
message = 'Browser not supported, use ' + browsers.map(function(browser, i) { message = 'Browser not supported, use ' + browsers.map(function(browser, i) {
return browser.name + ( return browser.name + (
@ -203,17 +203,17 @@ Ox.load.UI = function(options, callback) {
if ($.browser.opera && Ox.endsWith(file, '.svg')) { if ($.browser.opera && Ox.endsWith(file, '.svg')) {
return; return;
} }
Ox.print('load', file) //Ox.print('load', file)
var dfd = new $.Deferred(); var dfd = new $.Deferred();
Ox.loadFile(Ox.PATH + file, function() { Ox.loadFile(Ox.PATH + file, function() {
dfd.resolve(); dfd.resolve();
}); });
promises.push(dfd.promise()); promises.push(dfd.promise());
}); });
Ox.print('promises.length', promises.length) //Ox.print('promises.length', promises.length)
$.when.apply(null, promises) $.when.apply(null, promises)
.done(function() { .done(function() {
Ox.print('promises done') //Ox.print('promises done')
$(function() { $(function() {
if (options.showScreen && options.hideScreen) { if (options.showScreen && options.hideScreen) {
Ox.UI.hideLoadingScreen(); Ox.UI.hideLoadingScreen();
@ -273,7 +273,7 @@ Ox.load.UI = function(options, callback) {
+ filename.split('.').pop() + '/' + filename; + filename.split('.').pop() + '/' + filename;
}; };
Ox.UI.hideLoadingScreen = function() { Ox.UI.hideLoadingScreen = function() {
Ox.print('hideLoadingScreen') //Ox.print('hideLoadingScreen')
var $div = $('.OxLoadingScreen'), var $div = $('.OxLoadingScreen'),
error = $div.is('.OxError'); error = $div.is('.OxError');
//$div.find('img').remove(); //$div.find('img').remove();

View file

@ -1,6 +1,5 @@
@import url("../themes/classic/css/classic.css"); @import url("../themes/classic/css/classic.css");
@import url("../themes/modern/css/modern.css"); @import url("../themes/modern/css/modern.css");
//@import url("Ox.UI.future.css");
/* /*
================================================================================ ================================================================================

View file

@ -180,12 +180,14 @@
buffer += key == 'SPACE' ? ' ' : key; buffer += key == 'SPACE' ? ' ' : key;
bufferTime = time; bufferTime = time;
} }
focused !== null && Ox.UI.elements[focused].triggerEvent('key_' + key); if (focused !== null) {
Ox.UI.elements[focused].triggerEvent('key_' + key);
// fixme: oxdb context browser suggests we should add left and right keys here // fixme: oxdb context browser suggests we should add left and right keys here
if (['down', 'space', 'up'].indexOf(key) > -1 && !Ox.UI.elements[focused].hasClass('OxInput')) { if (['down', 'space', 'up'].indexOf(key) > -1 && !Ox.UI.elements[focused].hasClass('OxInput')) {
// prevent chrome from scrolling // prevent chrome from scrolling
return false; return false;
} }
}
/* /*
stack.forEach(function(v) { stack.forEach(function(v) {
// fixme: we dont get the return value! // fixme: we dont get the return value!

View file

@ -194,7 +194,7 @@ Ox.loadFile = (function() {
callback(); callback();
} }
function addFileToCache() { function addFileToCache() {
type == 'svg' && Ox.print('addToCache', file) //type == 'svg' && Ox.print('addToCache', file)
if (type == 'css' || type == 'js') { if (type == 'css' || type == 'js') {
cache['file'] = true; cache['file'] = true;
callback(); callback();
@ -650,10 +650,10 @@ Ox.makeObject = function(obj) {
undefined undefined
*/ */
var ret = {}; var ret = {};
if (obj.length == 1) { if (Ox.isObject(obj[0])) {
// ({foo: 'bar'}) // ({foo: 'bar'})
ret = obj[0]; ret = obj[0];
} else if (obj.length == 2){ } else if (obj.length) {
// ('foo', 'bar') // ('foo', 'bar')
ret[obj[0]] = obj[1] ret[obj[0]] = obj[1]
} }