allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: [#8183] use hidpi canvas polyfill, and avoid doing things that mess it up
Date Mon, 05 Feb 2018 14:25:45 GMT
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 Brondsema <dave@brondsema.net>
Authored: Fri Feb 2 14:25:11 2018 -0500
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Mon Feb 5 14:19:02 2018 +0000

----------------------------------------------------------------------
 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 0000000..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)&&b(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 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.strokeText))}(CanvasRenderingContext2D.prototype),function(a){a.getContext=function(a){return
function(b){var c,d,e=a.call(this,b);return"2d"===b&&(c=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1,d=(window.devicePixelRatio||1)/c,d>1&&(this.style.height=this.height+"px",this.style.width=this.w
 idth+"px",this.width*=d,this.height*=d)),e}}(a.getContext)}(HTMLCanvasElement.prototype);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/8c39d4f2/rat-excludes.txt
----------------------------------------------------------------------
diff --git a/rat-excludes.txt b/rat-excludes.txt
index 8a312b7..7c12b63 100644
--- a/rat-excludes.txt
+++ b/rat-excludes.txt
@@ -35,6 +35,7 @@ Allura/allura/public/nf/fonts/
 Allura/allura/public/nf/js/browser-polyfill.min.js
 Allura/allura/public/nf/js/chosen.jquery.min.js
 Allura/allura/public/nf/js/create-react-class.min.js
+Allura/allura/public/nf/js/hidpi-canvas.min.js
 Allura/allura/public/nf/js/jquery-base.js
 Allura/allura/public/nf/js/jquery-ui.min.js
 Allura/allura/public/nf/js/jquery.daterangepicker.js


Mime
View raw message