Skip to content

Commit

Permalink
Fix inverted logic in devicePixelRatio test
Browse files Browse the repository at this point in the history
The condition in the ternary operator is true if there's any
reason NOT to use the window.devicePixelRatio. Put the default
in the 'true' arm, and devicePixelRatio in the 'false' condition
where it's useful.

Tested on iOS with Safari's remote debugger, verified that dpr==2.
  • Loading branch information
scanlime authored and drewnoakes committed Aug 18, 2017
1 parent 406ccf5 commit f33ad75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion smoothie.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@
* Make sure the canvas has the optimal resolution for the device's pixel ratio.
*/
SmoothieChart.prototype.resize = function () {
var dpr = !this.options.enableDpiScaling || !window ? window.devicePixelRatio : 1,
var dpr = !this.options.enableDpiScaling || !window ? 1 : window.devicePixelRatio,
width, height;
if (this.options.responsive) {
// Newer behaviour: Use the canvas's size in the layout, and set the internal
Expand Down

0 comments on commit f33ad75

Please sign in to comment.