allura git commit: [#8183] use hidpi canvas polyfill, and avoid doing things that mess it up
Repository: allura Updated Branches: refs/heads/master a7be6461e -> 8c39d4f28 [#8183] use hidpi canvas polyfill, and avoid doing things that mess it up Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/8c39d4f2 Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/8c39d4f2 Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/8c39d4f2 Branch: refs/heads/master Commit: 8c39d4f28ec0a54b2fe999b30c5aa3d46156f418 Parents: a7be646 Author: Dave BrondsemaAuthored: Fri Feb 2 14:25:11 2018 -0500 Committer: Kenton Taylor Committed: Mon Feb 5 14:19:02 2018 + -- Allura/allura/lib/widgets/repo.py| 1 + Allura/allura/lib/widgets/resources/js/commit_browser.js | 5 + Allura/allura/public/nf/js/hidpi-canvas.min.js | 9 + rat-excludes.txt | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/allura/blob/8c39d4f2/Allura/allura/lib/widgets/repo.py -- diff --git a/Allura/allura/lib/widgets/repo.py b/Allura/allura/lib/widgets/repo.py index 4fa563d..d00640d 100644 --- a/Allura/allura/lib/widgets/repo.py +++ b/Allura/allura/lib/widgets/repo.py @@ -97,5 +97,6 @@ class SCMCommitBrowserWidget(ew_core.Widget): ) def resources(self): +yield ew.JSLink('allura/js/hidpi-canvas.min.js') yield ew.JSLink('js/commit_browser.js') yield ew.CSSLink('css/commit_browser.css') http://git-wip-us.apache.org/repos/asf/allura/blob/8c39d4f2/Allura/allura/lib/widgets/resources/js/commit_browser.js -- diff --git a/Allura/allura/lib/widgets/resources/js/commit_browser.js b/Allura/allura/lib/widgets/resources/js/commit_browser.js index 6db6e72..01359ff 100644 --- a/Allura/allura/lib/widgets/resources/js/commit_browser.js +++ b/Allura/allura/lib/widgets/resources/js/commit_browser.js @@ -84,8 +84,6 @@ if($('#commit_graph')){ var commit_rows = []; var taken_coords = {}; -canvas.height = 300; -highlighter.height = canvas.height; highlighter_ctx.fillStyle = "#ccc"; function setHeight(cnt) { @@ -101,8 +99,7 @@ if($('#commit_graph')){ } function drawGraph(offset) { -// Clear the canvas and set the contetx -var canvas_ctx = canvas.getContext('2d'); +// Clear the canvas highlighter_ctx.clearRect(0, 0, canvas.width, canvas.height); canvas_ctx.clearRect(0, 0, canvas.width, canvas.height); canvas_ctx.fillStyle = "rgb(0,0,0)"; http://git-wip-us.apache.org/repos/asf/allura/blob/8c39d4f2/Allura/allura/public/nf/js/hidpi-canvas.min.js -- diff --git a/Allura/allura/public/nf/js/hidpi-canvas.min.js b/Allura/allura/public/nf/js/hidpi-canvas.min.js new file mode 100644 index 000..5447c71 --- /dev/null +++ b/Allura/allura/public/nf/js/hidpi-canvas.min.js @@ -0,0 +1,9 @@ +/** + * HiDPI Canvas Polyfill (1.0.10) + * + * Author: Jonathan D. Johnson (http://jondavidjohn.com) + * Homepage: https://github.com/jondavidjohn/hidpi-canvas-polyfill + * Issue Tracker: https://github.com/jondavidjohn/hidpi-canvas-polyfill/issues + * License: Apache-2.0 +*/ +!function(a){var b=function(){var a=document.createElement("canvas"),b=a.getContext("2d"),c=b.backingStorePixelRatio||b.webkitBackingStorePixelRatio||b.mozBackingStorePixelRatio||b.msBackingStorePixelRatio||b.oBackingStorePixelRatio||b.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/c}(),c=function(a,b){for(var c in a)a.hasOwnProperty(c)&(a[c],c)},d={fillRect:"all",clearRect:"all",strokeRect:"all",moveTo:"all",lineTo:"all",arc:[0,1,2],arcTo:"all",bezierCurveTo:"all",isPointinPath:"all",isPointinStroke:"all",quadraticCurveTo:"all",rect:"all",translate:"all",createRadialGradient:"all",createLinearGradient:"all"};1!==b&&(c(d,function(c,d){a[d]=function(a){return function(){var d,e,f=Array.prototype.slice.call(arguments);if("all"===c)f=f.map(function(a){return a*b});else if(Array.isArray(c))for(d=0,e=c.length;e>d;d++)f[c[d]]*=b;return a.apply(this,f)}}(a[d])}),a.stroke=function(a){return function(){this.lineWidth*=b,a.apply(this,arguments),this.lineWidth/=b}}(a.stroke),a. fillText=function(a){return function(){var c=Array.prototype.slice.call(arguments);c[1]*=b,c[2]*=b,this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c*b+d}),a.apply(this,c),this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c/b+d})}}(a.fillText),a.strokeText=function(a){return function(){var
allura git commit: [#8183] use hidpi canvas polyfill, and avoid doing things that mess it up
Repository: allura Updated Branches: refs/heads/db/8183 [created] 868592294 [#8183] use hidpi canvas polyfill, and avoid doing things that mess it up Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/86859229 Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/86859229 Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/86859229 Branch: refs/heads/db/8183 Commit: 868592294522ceab04670acfb93c4d0ace99e707 Parents: daefc6a Author: Dave BrondsemaAuthored: Fri Feb 2 14:25:11 2018 -0500 Committer: Dave Brondsema Committed: Fri Feb 2 14:29:45 2018 -0500 -- Allura/allura/lib/widgets/repo.py| 1 + Allura/allura/lib/widgets/resources/js/commit_browser.js | 5 + Allura/allura/public/nf/js/hidpi-canvas.min.js | 9 + rat-excludes.txt | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/allura/blob/86859229/Allura/allura/lib/widgets/repo.py -- diff --git a/Allura/allura/lib/widgets/repo.py b/Allura/allura/lib/widgets/repo.py index 4fa563d..d00640d 100644 --- a/Allura/allura/lib/widgets/repo.py +++ b/Allura/allura/lib/widgets/repo.py @@ -97,5 +97,6 @@ class SCMCommitBrowserWidget(ew_core.Widget): ) def resources(self): +yield ew.JSLink('allura/js/hidpi-canvas.min.js') yield ew.JSLink('js/commit_browser.js') yield ew.CSSLink('css/commit_browser.css') http://git-wip-us.apache.org/repos/asf/allura/blob/86859229/Allura/allura/lib/widgets/resources/js/commit_browser.js -- diff --git a/Allura/allura/lib/widgets/resources/js/commit_browser.js b/Allura/allura/lib/widgets/resources/js/commit_browser.js index 6db6e72..01359ff 100644 --- a/Allura/allura/lib/widgets/resources/js/commit_browser.js +++ b/Allura/allura/lib/widgets/resources/js/commit_browser.js @@ -84,8 +84,6 @@ if($('#commit_graph')){ var commit_rows = []; var taken_coords = {}; -canvas.height = 300; -highlighter.height = canvas.height; highlighter_ctx.fillStyle = "#ccc"; function setHeight(cnt) { @@ -101,8 +99,7 @@ if($('#commit_graph')){ } function drawGraph(offset) { -// Clear the canvas and set the contetx -var canvas_ctx = canvas.getContext('2d'); +// Clear the canvas highlighter_ctx.clearRect(0, 0, canvas.width, canvas.height); canvas_ctx.clearRect(0, 0, canvas.width, canvas.height); canvas_ctx.fillStyle = "rgb(0,0,0)"; http://git-wip-us.apache.org/repos/asf/allura/blob/86859229/Allura/allura/public/nf/js/hidpi-canvas.min.js -- diff --git a/Allura/allura/public/nf/js/hidpi-canvas.min.js b/Allura/allura/public/nf/js/hidpi-canvas.min.js new file mode 100644 index 000..5447c71 --- /dev/null +++ b/Allura/allura/public/nf/js/hidpi-canvas.min.js @@ -0,0 +1,9 @@ +/** + * HiDPI Canvas Polyfill (1.0.10) + * + * Author: Jonathan D. Johnson (http://jondavidjohn.com) + * Homepage: https://github.com/jondavidjohn/hidpi-canvas-polyfill + * Issue Tracker: https://github.com/jondavidjohn/hidpi-canvas-polyfill/issues + * License: Apache-2.0 +*/ +!function(a){var b=function(){var a=document.createElement("canvas"),b=a.getContext("2d"),c=b.backingStorePixelRatio||b.webkitBackingStorePixelRatio||b.mozBackingStorePixelRatio||b.msBackingStorePixelRatio||b.oBackingStorePixelRatio||b.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/c}(),c=function(a,b){for(var c in a)a.hasOwnProperty(c)&(a[c],c)},d={fillRect:"all",clearRect:"all",strokeRect:"all",moveTo:"all",lineTo:"all",arc:[0,1,2],arcTo:"all",bezierCurveTo:"all",isPointinPath:"all",isPointinStroke:"all",quadraticCurveTo:"all",rect:"all",translate:"all",createRadialGradient:"all",createLinearGradient:"all"};1!==b&&(c(d,function(c,d){a[d]=function(a){return function(){var d,e,f=Array.prototype.slice.call(arguments);if("all"===c)f=f.map(function(a){return a*b});else if(Array.isArray(c))for(d=0,e=c.length;e>d;d++)f[c[d]]*=b;return a.apply(this,f)}}(a[d])}),a.stroke=function(a){return function(){this.lineWidth*=b,a.apply(this,arguments),this.lineWidth/=b}}(a.stroke),a. fillText=function(a){return function(){var c=Array.prototype.slice.call(arguments);c[1]*=b,c[2]*=b,this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c*b+d}),a.apply(this,c),this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(a,c,d){return c/b+d})}}(a.fillText),a.strokeText=function(a){return function(){var