Showing the changes to scripts/developer/debugging/debugWindow.js (1 of 3 files). Show all
Unified · Split
| @@ -22,14 +22,37 @@ if (scripts.length >= 2) { · 21 unmodified lines | ||
| 22 | 22 | // Set up the qml ui |
| 23 | 23 | var qml = Script.resolvePath('debugWindow.qml'); |
| 24 | 24 | |
| 25 | +var HMD_DEBUG_WINDOW_GEOMETRY_KEY = 'hmdDebugWindowGeometry'; | |
| 26 | +var hmdDebugWindowGeometryValue = Settings.getValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY) | |
| 27 | + | |
| 28 | +var windowWidth = 400; | |
| 29 | +var windowHeight = 900; | |
| 30 | + | |
| 31 | +var hasPosition = false; | |
| 32 | +var windowX = 0; | |
| 33 | +var windowY = 0; | |
| 34 | + | |
| 35 | +if (hmdDebugWindowGeometryValue !== '') { | |
| 36 | + var geometry = JSON.parse(hmdDebugWindowGeometryValue); | |
| 37 | + | |
| 38 | + windowWidth = geometry.width | |
| 39 | + windowHeight = geometry.height | |
| 40 | + windowX = geometry.x | |
| 41 | + windowY = geometry.y | |
| 42 | + hasPosition = true; | |
| 43 | +} | |
| 44 | + | |
| 25 | 45 | var window = new OverlayWindow({ |
| 26 | 46 | title: 'Debug Window', |
| 27 | 47 | source: qml, |
| 28 | − width: 400, height: 900, | |
| 48 | + width: windowWidth, height: windowHeight, | |
| 29 | 49 | }); |
| 30 | 50 | |
| 31 | −window.setPosition(25, 50); | |
| 32 | −window.closed.connect(function() { Script.stop(); }); | |
| 51 | +if (hasPosition) { | |
| 52 | + window.setPosition(windowX, windowY); | |
| 53 | +} | |
| 54 | + | |
| 55 | +window.closed.connect(function () { Script.stop(); }); | |
| 33 | 56 | |
| 34 | 57 | var getFormattedDate = function() { |
| 35 | 58 | var date = new Date(); |
| @@ -65,6 +88,14 @@ ScriptDiscoveryService.clearDebugWindow.connect(function() { · 29 unmodified lines | ||
| 65 | 88 | }); |
| 66 | 89 | |
| 67 | 90 | Script.scriptEnding.connect(function () { |
| 91 | + var geometry = JSON.stringify({ | |
| 92 | + x: window.position.x, | |
| 93 | + y: window.position.y, | |
| 94 | + width: window.size.x, | |
| 95 | + height: window.size.y | |
| 96 | + }) | |
| 97 | + | |
| 98 | + Settings.setValue(HMD_DEBUG_WINDOW_GEOMETRY_KEY, geometry); | |
| 68 | 99 | window.close(); |
| 69 | 100 | }) |
| 70 | 101 | |