Skip to content

Commit

Permalink
reworked pixel ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Rowell authored and Eric Rowell committed Apr 23, 2019
1 parent 35a1335 commit ee58d09
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
13 changes: 3 additions & 10 deletions build/concrete.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Concrete v3.0.4
* A lightweight Html5 Canvas framework that enables hit detection, layering, multi buffering,
* pixel ratio management, exports, and image downloads
* Release Date: 4-21-2019
* Release Date: 4-22-2019
* https://github.com/ericdrowell/concrete
* Licensed under the MIT or GPL Version 2 licenses.
*
Expand All @@ -29,15 +29,8 @@
var Concrete = {},
idCounter = 0;

Concrete.PIXEL_RATIO = (function() {
// client browsers
if (window && window.navigator && window.navigator.userAgent && !/PhantomJS/.test(window.navigator.userAgent)) {
return 2;
}
// headless browsers
else {
return 1;
}
Concrete.PIXEL_RATIO = (function () {
return (window && window.devicePixelRatio) || 1;
})();

Concrete.viewports = [];
Expand Down
4 changes: 2 additions & 2 deletions build/concrete.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "concretejs",
"version": "3.0.4",
"version": "3.0.5",
"main": "build/concrete.min.js",
"keywords": [
"html5",
Expand Down
13 changes: 3 additions & 10 deletions src/concrete.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
var Concrete = {},
idCounter = 0;

Concrete.PIXEL_RATIO = (function(win) {
// client browsers
if (win && win.navigator && win.navigator.userAgent && !/PhantomJS/.test(win.navigator.userAgent)) {
return 2;
}
// headless browsers
else {
return 1;
}
})(typeof window !== 'undefined' ? window : null);
Concrete.PIXEL_RATIO = (function () {
return (window && window.devicePixelRatio) || 1;
})();

Concrete.viewports = [];

Expand Down

0 comments on commit ee58d09

Please sign in to comment.