--- a/org.symbian.tools.wrttools.previewer/preview/css/style.css Thu Jul 01 09:57:41 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/css/style.css Thu Jul 01 15:01:44 2010 -0700
@@ -729,4 +729,17 @@
margin-right: 15px;
text-align: center;
width: 6ex;
-}
\ No newline at end of file
+}
+
+.button-clockwise {
+ background: url("../images/rotate-buttons.png") !important;
+}
+
+.button-cclockwise {
+ background: url("../images/rotate-buttons.png") !important;
+ background-attachment: scroll !important;
+ background-position: 16px 0 !important;
+}
+
+
+
Binary file org.symbian.tools.wrttools.previewer/preview/images/rotate-buttons.png has changed
Binary file org.symbian.tools.wrttools.previewer/preview/images/rotate-left.png has changed
Binary file org.symbian.tools.wrttools.previewer/preview/images/rotate-right.png has changed
--- a/org.symbian.tools.wrttools.previewer/preview/script/accelerometer.js Thu Jul 01 09:57:41 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/accelerometer.js Thu Jul 01 15:01:44 2010 -0700
@@ -14,7 +14,7 @@
setupListeners("zaxis", "zleft", "zright", updateAngleZ, this.angleZ);
window.setTimeout(function() {
- control.paint();
+ control.paint(true);
}, 50);
function setupListeners(inputId, leftArrow, rightArrow, fn, initial) {
@@ -99,7 +99,7 @@
var r = 62;
- var xy = (this.angleX - 180) * Math.PI / 180;
+ var xy = (180 - this.angleX) * Math.PI / 180;
var yz = (this.angleY - 180) * Math.PI / 180;
var xz = (180 - this.angleZ) * Math.PI / 180 + Math.PI / 2;
--- a/org.symbian.tools.wrttools.previewer/preview/script/emulator.js Thu Jul 01 09:57:41 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/emulator.js Thu Jul 01 15:01:44 2010 -0700
@@ -20,6 +20,10 @@
DisplayUpwards : "DisplayUpwards",
DisplayDownwards : "DisplayDownwards"
};
+var MODES = {
+ portrait : "portrait",
+ landscape : "landscape"
+};
function Emulator() {
this.child = false;
@@ -84,7 +88,7 @@
if (orientation != this.orientation) {
this.orientation = orientation;
- NOKIA.helper.setPreference("__SYM_DEVICE_ORIENTATION", orientation);
+ NOKIA.helper.setPreference(EmulatorPreferences.ORIENTATION, orientation);
NOKIA.emulator.render();
}
@@ -96,12 +100,38 @@
Emulator.prototype.setAccelerationValues = function(x, y, z) {
window.setTimeout(function() {
- NOKIA.emulator.accelerationChanged(x, y, z);
- NOKIA.rotationSupport.setAngles(x * 90, y * 90,
- z * 90);
+ NOKIA.rotationSupport.setAngles(x * 90, y * 90, z * 90);
}, 5);
};
+Emulator.prototype.showOrientationAngles = function(orientation) {
+ switch (orientation) {
+ case ORIENTATIONS.DisplayUp:
+ this.setAccelerationValues(0, 0, 0);
+ break;
+ case ORIENTATIONS.DisplayDown:
+ this.setAccelerationValues(2, 0, 0);
+ break;
+ case ORIENTATIONS.DisplayRightUp:
+ this.setAccelerationValues(-1, 0, 0);
+ break;
+ case ORIENTATIONS.DisplayLeftUp:
+ this.setAccelerationValues(1, 0, 0);
+ break;
+ case ORIENTATIONS.DisplayUpwards:
+ this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, 1);
+ break;
+ case ORIENTATIONS.DisplayDownwards:
+ this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, -1);
+ break;
+ }
+ this.orientation = orientation;
+ NOKIA.helper.setPreference(EmulatorPreferences.ORIENTATION, orientation);
+ window.setTimeout(function() {
+ NOKIA.emulator.render();
+ }, 50);
+};
+
Emulator.prototype.load = function() {
if (this.loaded)
return false;
@@ -116,29 +146,10 @@
if (mode != null)
NOKIA.mode = mode;
- var orientation = NOKIA.helper.getPreference("__SYM_DEVICE_ORIENTATION");
+ var orientation = NOKIA.helper.getPreference(EmulatorPreferences.ORIENTATION);
if (orientation != null) {
this.orientation = orientation;
- switch (orientation) {
- case ORIENTATIONS.DisplayUp:
- this.setAccelerationValues(0, 0, 0);
- break;
- case ORIENTATIONS.DisplayDown:
- this.setAccelerationValues(2, 0, 0);
- break;
- case ORIENTATIONS.DisplayRightUp:
- this.setAccelerationValues(1, 0, 0);
- break;
- case ORIENTATIONS.DisplayLeftUp:
- this.setAccelerationValues(-1, 0, 0);
- break;
- case ORIENTATIONS.DisplayUpwards:
- this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, 1);
- break;
- case ORIENTATIONS.DisplayDownwards:
- this.setAccelerationValues(NOKIA.mode == 'portrait' ? 0 : 1, 0, -1);
- break;
- }
+ this.showOrientationAngles(orientation);
}
// SAVE the device DATA
@@ -299,6 +310,58 @@
});
};
+Emulator.prototype.turn = function(direction) {
+ var newOrientation = ORIENTATIONS.DisplayUp;
+ if (direction > 0) { // Clockwise
+ switch (this.orientation) {
+ case ORIENTATIONS.DisplayUp:
+ newOrientation = ORIENTATIONS.DisplayLeftUp;
+ break;
+ case ORIENTATIONS.DisplayLeftUp:
+ newOrientation = ORIENTATIONS.DisplayDown;
+ break;
+ case ORIENTATIONS.DisplayDown:
+ newOrientation = ORIENTATIONS.DisplayRightUp;
+ break;
+ case ORIENTATIONS.DisplayRightUp:
+ newOrientation = ORIENTATIONS.DisplayUp;
+ break;
+ default:
+ if (this.mode == MODES.portrait) {
+ newOrientation = ORIENTATIONS.DisplayRightUp;
+ } else {
+ newOrientation = ORIENTATIONS.DisplayUp;
+ }
+ break;
+ }
+ } else {
+ switch (this.orientation) {
+ case ORIENTATIONS.DisplayUp:
+ newOrientation = ORIENTATIONS.DisplayRightUp;
+ break;
+ case ORIENTATIONS.DisplayLeftUp:
+ newOrientation = ORIENTATIONS.DisplayUp;
+ break;
+ case ORIENTATIONS.DisplayDown:
+ newOrientation = ORIENTATIONS.DisplayLeftUp;
+ break;
+ case ORIENTATIONS.DisplayRightUp:
+ newOrientation = ORIENTATIONS.DisplayDown;
+ break;
+ default:
+ if (this.mode == MODES.portrait) {
+ newOrientation = ORIENTATIONS.DisplayRightUp;
+ } else {
+ newOrientation = ORIENTATIONS.DisplayUp;
+ }
+ break;
+ }
+ }
+ this.orientation = newOrientation;
+ this.showOrientationAngles(newOrientation);
+ this.render();
+};
+
function EmulatorState(x, y, z, orientation) {
this.XAxis = x;
this.YAxis = y;
--- a/org.symbian.tools.wrttools.previewer/preview/script/helper.js Thu Jul 01 09:57:41 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/helper.js Thu Jul 01 15:01:44 2010 -0700
@@ -306,6 +306,19 @@
$(".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *").removeClass(
"ui-corner-all ui-corner-top").addClass("ui-corner-bottom");
+ $("#clockwise").button( {
+ icons : {
+ primary : "button-clockwise"
+ },
+ text : null
+ }).click(function() {NOKIA.emulator.turn(1);});
+ $("#cclockwise").button( {
+ icons : {
+ primary : "button-cclockwise"
+ },
+ text : null
+ }).click(function() {NOKIA.emulator.turn(-1);});
+
$("#xleft").button( {
icons : {
primary : 'ui-icon-triangle-1-w'
--- a/org.symbian.tools.wrttools.previewer/preview/script/nokia.js Thu Jul 01 09:57:41 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/script/nokia.js Thu Jul 01 15:01:44 2010 -0700
@@ -174,5 +174,6 @@
window.onresize = NOKIA.layout.render;
var EmulatorPreferences = {
- SELECTED_TAB:"__SYM_SELECTED_CONTROLS_TAB"
+ SELECTED_TAB: "__SYM_SELECTED_CONTROLS_TAB",
+ ORIENTATION: "__SYM_DEVICE_ORIENTATION"
};
--- a/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html Thu Jul 01 09:57:41 2010 -0700
+++ b/org.symbian.tools.wrttools.previewer/preview/wrt_preview.html Thu Jul 01 15:01:44 2010 -0700
@@ -99,12 +99,14 @@
<tr>
<th>Screen Resolution:</th>
<td>
+ <div id="clockwise" title="Rotate Clockwise"> </div>
<select id="resOptions" size="1">
<option selected="selected" value="http://www.forum.nokia.com/devices/matrix_240x320_1.html">240x320</option>
<option value="http://www.forum.nokia.com/devices/matrix_320x240_1.html">320x240</option>
<option value="http://www.forum.nokia.com/devices/matrix_360x640_1.html">360x640</option>
<option value="http://www.forum.nokia.com/devices/E90_Communicator">800x352</option>
</select>
+ <div id="cclockwise" title="Rotate Counterclockwise"> </div>
</td>
</tr>
<tr>
@@ -112,9 +114,9 @@
<canvas width="140px" height="120px" id="phoneposition" >No canvas available</canvas>
</th>
<td>
- <div><button id="xleft"></button><input id="xaxis" class="ui-widget axis-entry"/><button id="xright"></button></div>
- <div><button id="yleft"></button><input id="yaxis" class="ui-widget axis-entry"/><button id="yright"></button></div>
- <div><button id="zleft"></button><input id="zaxis" class="ui-widget axis-entry"/><button id="zright"></button></div>
+ <div><div id="xleft"> </div><input id="xaxis" class="ui-widget axis-entry"/><div id="xright"> </div></div>
+ <div><div id="yleft"> </div><input id="yaxis" class="ui-widget axis-entry"/><div id="yright"> </div></div>
+ <div><div id="zleft"> </div><input id="zaxis" class="ui-widget axis-entry"/><div id="zright"> </div></div>
</td>
</tr>
</table>