Skip to content

Commit

Permalink
scan qr code with devicePixelRatio for retina displays
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneezry committed May 1, 2015
1 parent fedddbb commit 5d298ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 0 additions & 7 deletions javascript/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ function getQr(tab, left, top, width, height, windowWidth) {
var qr = new Image();
qr.src = dataUrl;
qr.onload = function () {
if (windowWidth * 2 === qr.width) {
//Retina Display
left *= 2;
top *= 2;
width *= 2;
height *= 2;
}
this.tab = tab;
var captureCanvas = document.getElementById('__ga_captureCanvas__');
if (!captureCanvas) {
Expand Down
4 changes: 4 additions & 0 deletions javascript/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ function grayLayoutUp(event) {
var captureBoxTop = Math.min(this.captureBoxTop, e.clientY) + 1;
var captureBoxWidth = Math.abs(this.captureBoxLeft - e.clientX) - 1;
var captureBoxHeight = Math.abs(this.captureBoxTop - e.clientY) - 1;
captureBoxLeft *= window.devicePixelRatio;
captureBoxTop *= window.devicePixelRatio;
captureBoxWidth *= window.devicePixelRatio;
captureBoxHeight *= window.devicePixelRatio;
setTimeout(function () {
captureBox.style.display = 'none';
grayLayout.style.display = 'none';
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extName__",
"short_name": "__MSG_extShortName__",
"version": "4.13",
"version": "4.14",
"default_locale": "en",
"description": "__MSG_extDesc__",
"icons": {
Expand Down

0 comments on commit 5d298ff

Please sign in to comment.