浏览代码

fixed corpus map canvas resolution

Bachir Soussi Chiadmi 6 年之前
父节点
当前提交
2df8d15d91

文件差异内容过多而无法显示
+ 0 - 0
sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js


+ 4 - 2
sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js

@@ -21,10 +21,10 @@
     var _activated = true;
     var _$body = $('body');
     var _$container = _$body;
-    var _dpi = window.devicePixelRatio;
     var _$canvas = $('<canvas id="corpus-map">').appendTo(_$container);
     var _canvas = _$canvas[0];
     var _ctx = _canvas.getContext('2d');
+    var _dpi = window.devicePixelRatio;
     var _canvas_props = {
       // 'margin_top':90, // with red border on head
       // 'margin_top':75, // without red border on head
@@ -95,9 +95,11 @@
       onResizeCanvas();
     };
     function onResizeCanvas() {
-      // https://medium.com/wdstack/fixing-html5-2d-canvas-blur-8ebe27db07da
+      _canvas.style.width = window.innerWidth;
+      _canvas.style.height = window.innerHeight;
       _canvas.width = window.innerWidth*_dpi;
       _canvas.height = window.innerHeight*_dpi;
+      _ctx.scale(_dpi, _dpi);
 
 
       if(_nodes.length){

部分文件因为文件数量过多而无法显示