Browse Source

- Fixed bug when redrawing was not right on zoomed-out browsers.

v3_develop
Alex de Mulder 9 years ago
parent
commit
aa17f03fba
2 changed files with 10 additions and 10 deletions
  1. +5
    -5
      dist/vis.js
  2. +5
    -5
      lib/network/Network.js

+ 5
- 5
dist/vis.js View File

@ -23594,7 +23594,7 @@ return /******/ (function(modules) { // webpackBootstrap
ctx.oBackingStorePixelRatio || ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1); ctx.backingStorePixelRatio || 1);
this.pixelRatio = Math.max(1,this.pixelRatio); // this is to account for browser zooming out. The pixel ratio is ment to switch between 1 and 2 for HD screens.
//this.pixelRatio = Math.max(1,this.pixelRatio); // this is to account for browser zooming out. The pixel ratio is ment to switch between 1 and 2 for HD screens.
this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
} }
@ -24666,8 +24666,8 @@ return /******/ (function(modules) { // webpackBootstrap
ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
// clear the canvas // clear the canvas
var w = this.frame.canvas.clientWidth * this.pixelRatio;
var h = this.frame.canvas.clientHeight * this.pixelRatio;
var w = this.frame.canvas.clientWidth;
var h = this.frame.canvas.clientHeight;
ctx.clearRect(0, 0, w, h); ctx.clearRect(0, 0, w, h);
// set scaling and translation // set scaling and translation
@ -24680,8 +24680,8 @@ return /******/ (function(modules) { // webpackBootstrap
"y": this._YconvertDOMtoCanvas(0) "y": this._YconvertDOMtoCanvas(0)
}; };
this.canvasBottomRight = { this.canvasBottomRight = {
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth * this.pixelRatio),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight * this.pixelRatio)
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)
}; };
if (!(hidden == true)) { if (!(hidden == true)) {

+ 5
- 5
lib/network/Network.js View File

@ -849,7 +849,7 @@ Network.prototype._create = function () {
ctx.oBackingStorePixelRatio || ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1); ctx.backingStorePixelRatio || 1);
this.pixelRatio = Math.max(1,this.pixelRatio); // this is to account for browser zooming out. The pixel ratio is ment to switch between 1 and 2 for HD screens.
//this.pixelRatio = Math.max(1,this.pixelRatio); // this is to account for browser zooming out. The pixel ratio is ment to switch between 1 and 2 for HD screens.
this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
} }
@ -1921,8 +1921,8 @@ Network.prototype._redraw = function(hidden) {
ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
// clear the canvas // clear the canvas
var w = this.frame.canvas.clientWidth * this.pixelRatio;
var h = this.frame.canvas.clientHeight * this.pixelRatio;
var w = this.frame.canvas.clientWidth;
var h = this.frame.canvas.clientHeight;
ctx.clearRect(0, 0, w, h); ctx.clearRect(0, 0, w, h);
// set scaling and translation // set scaling and translation
@ -1935,8 +1935,8 @@ Network.prototype._redraw = function(hidden) {
"y": this._YconvertDOMtoCanvas(0) "y": this._YconvertDOMtoCanvas(0)
}; };
this.canvasBottomRight = { this.canvasBottomRight = {
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth * this.pixelRatio),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight * this.pixelRatio)
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)
}; };
if (!(hidden == true)) { if (!(hidden == true)) {

Loading…
Cancel
Save