org.symbian.tools.wrttools.previewer/preview/script/emulator.js
changeset 407 c7c8bde493b1
parent 403 ba20dd5983c7
child 412 72448215f517
--- a/org.symbian.tools.wrttools.previewer/preview/script/emulator.js	Wed Jun 30 14:04:26 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/emulator.js	Wed Jun 30 16:50:22 2010 -0700
@@ -97,8 +97,8 @@
 Emulator.prototype.setAccelerationValues = function(x, y, z) {
 	window.setTimeout(function() {
 		NOKIA.emulator.accelerationChanged(x, y, z);
-		NOKIA.rotationSupport.setAngles(180 - x * 90, y * 90 + 180,
-				180 + z * 90);
+		NOKIA.rotationSupport.setAngles(x * 90, y * 90,
+				z * 90);
 	}, 5);
 };
 
@@ -111,6 +111,11 @@
 	var device = NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_DEVICE');
 	NOKIA.currentDevice = device || NOKIA.currentDevice;
 
+	// load the saved device mode
+	var mode = NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE');
+	if (mode != null)
+		NOKIA.mode = mode;
+
 	var orientation = NOKIA.helper.getPreference("__SYM_DEVICE_ORIENTATION");
 	if (orientation != null) {
 		this.orientation = orientation;
@@ -128,19 +133,14 @@
 			this.setAccelerationValues(-1, 0, 0);
 			break;
 		case ORIENTATIONS.DisplayUpwards:
-			this.setAccelerationValues(0, 0, 1);
+			this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, 1);
 			break;
 		case ORIENTATIONS.DisplayDownwards:
-			this.setAccelerationValues(0, 0, -1);
+			this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, -1);
 			break;
 		}
 	}
 
-	// load the saved device mode
-	var mode = NOKIA.helper.getPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE');
-	if (mode != null)
-		NOKIA.mode = mode;
-
 	// SAVE the device DATA
 	NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE',
 			NOKIA.currentDevice);
@@ -189,6 +189,7 @@
 			NOKIA.mode = 'landscape';
 		}
 	}
+	NOKIA.helper.setPreference('__SYM_NOKIA_EMULATOR_DEVICE_MODE', NOKIA.mode);
 
 	if (!NOKIA.emulator.orientationSupports())
 		NOKIA.mode = NOKIA.deviceList[NOKIA.currentDevice]['default'];