Advertisement
pbin00app

Preware - Fix Screenshots

Jul 7th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. From 4d9b66df066998b4f1a72cb4fc8f9d4f464ee593 Mon Sep 17 00:00:00 2001
  2. From: Appsotutely <opensource@appsotutely.com>
  3. Date: Fri, 8 Jul 2011 00:12:53 -0400
  4. Subject: [PATCH] Fix for screenshots scene to rotate properly on TouchPad
  5.  
  6. ---
  7. app/assistants/screenshots-assistant.js | 18 +++++++++++++++---
  8. 1 files changed, 15 insertions(+), 3 deletions(-)
  9.  
  10. diff --git a/app/assistants/screenshots-assistant.js b/app/assistants/screenshots-assistant.js
  11. index 22f88fd..6f0cf39 100644
  12. --- a/app/assistants/screenshots-assistant.js
  13. +++ b/app/assistants/screenshots-assistant.js
  14. @@ -8,6 +8,7 @@ ScreenshotsAssistant.prototype.setup = function()
  15. {
  16. try
  17. {
  18. + this.controller.window.onresize = this.handleOrientation.bind(this);
  19. // setup back tap
  20. this.backElement = this.controller.get('back');
  21. this.backTapHandler = this.backTap.bindAsEventListener(this);
  22. @@ -93,13 +94,13 @@ ScreenshotsAssistant.prototype.getSizeInfo = function(ss) {
  23. img.src = ss;
  24. img.onload = function() {
  25. var ssRatio = img.height / img.width,
  26. - windowRatio = Mojo.Environment.DeviceInfo.screenHeight / Mojo.Environment.DeviceInfo.screenWidth,
  27. + windowRatio = this.controller.window.innerHeight / this.controller.window.innerWidth,
  28. scaleWidth, scaleHeight;
  29. if (ssRatio < windowRatio) {
  30. - scaleWidth = Mojo.Environment.DeviceInfo.screenWidth;
  31. + scaleWidth = this.controller.window.innerWidth;
  32. scaleHeight = parseInt((scaleWidth * ssRatio), 10);
  33. } else {
  34. - scaleHeight = Mojo.Environment.DeviceInfo.screenHeight;
  35. + scaleHeight = this.controller.window.innerHeight;
  36. scaleWidth = parseInt((scaleHeight / ssRatio), 10);
  37. }
  38. this.controller.get('screenshotView').mojo.manualSize(scaleWidth,scaleHeight);
  39. @@ -124,6 +125,14 @@ ScreenshotsAssistant.prototype.orientationChanged = function(orientation)
  40. };
  41. */
  42.  
  43. +ScreenshotsAssistant.prototype.handleOrientation = function(){
  44. + this.controller.get('ss-scene').style.height = this.controller.window.innerHeight + "px";
  45. + this.controller.get('ss-scene').style.width = this.controller.window.innerWidth + "px";
  46. + this.controller.get('screenshotView').style.height = this.controller.window.innerHeight + "px";
  47. + this.controller.get('screenshotView').style.width = this.controller.window.innerWidth + "px";
  48. + this.getSizeInfo(this.screenshots[this.current]);
  49. +};
  50. +
  51. ScreenshotsAssistant.prototype.activate = function(event)
  52. {
  53. try
  54. @@ -134,9 +143,12 @@ ScreenshotsAssistant.prototype.activate = function(event)
  55. }
  56. */
  57.  
  58. + /*
  59. this.controller.get('ss-scene').style.width = Mojo.Environment.DeviceInfo.screenWidth + 'px';
  60. this.controller.get('ss-scene').style.height = Mojo.Environment.DeviceInfo.screenHeight + 'px';
  61. this.getSizeInfo(this.screenshots[this.current]);
  62. + */
  63. + this.handleOrientation();
  64.  
  65. if (this.controller.window.PalmSystem)
  66. {
  67. --
  68. 1.7.4.msysgit.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement