Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ <h2>Pixel Ratio</h2>
<div style="padding: 5px; float: left;"><input type="range" id="pixelRatio" min="0.75" max="3" step="0.25" style="width: 150px;" /></div>
<div style="clear: both;"></div>
</div>
<h2>Default Ratio</h2>
<div style="background-color: #FFF;">
<div id="DefaultDisplay" style="width: 60px; margin: 5px 15px; float: left;"></div>
<div style="padding: 5px; float: left;"><input type="range" id="defaultRatio" min="0.75" max="3" step="0.25" style="width: 150px;" /></div>
<div style="clear: both;"></div>
</div>
</body>
</html>
10 changes: 10 additions & 0 deletions data/panel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var geometry = document.getElementById('geometry');
var pixelRatioInput = document.getElementById('pixelRatio');
var pixelRatioDisplay = document.getElementById('pixelRatioDisplay');
var defaultRatioInput = document.getElementById('defaultRatio');
var defaulRatioDisplay = document.getElementById('DefaultDisplay');

pixelRatioInput.addEventListener('input', function (event) {
pixelRatioDisplay.textContent = event.target.value + 'x';
Expand All @@ -10,6 +12,14 @@ pixelRatioInput.addEventListener('change', function (event) {
self.port.emit('pixelRatioChanged', parseFloat(event.target.value));
}, false);

defaultRatioInput.addEventListener('input', function (event) {
defaulRatioDisplay.textContent = event.target.value + 'x';
}, false);

defaultRatioInput.addEventListener('change', function (event) {
self.port.emit('defaultRatioChanged', parseFloat(event.target.value));
}, false);

self.port.on('update', function (event) {
geometry.textContent = 'width=' + event.screen.width +
' height=' + event.screen.height +
Expand Down
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var self = require('sdk/self');
var storage = require('sdk/simple-storage').storage;
var events = require('sdk/system/events');

const DEFAULT_PIXEL_RATIO = 1;
DEFAULT_PIXEL_RATIO = 1;
const UPDATE_INTERVAL_MS = 500;
const SLACK = 128;

Expand Down Expand Up @@ -168,5 +168,14 @@ panel.port.on('pixelRatioChanged', function (pixelRatio) {

update(true);
});
panel.port.on('defaultRatioChanged', function (pixelRatio) {
DEFAULT_PIXEL_RATIO=pixelRatio;
resetDevPixelsPerPx();

savePixelRatio(getActiveScreen(), pixelRatio);
console.log('saved pixelRatio', pixelRatio);

update(true);
});

update(true);