Browse Source

- Made autoscaling on container size change pick the lowest between delta height and delta width.

webworkersNetwork
Alex de Mulder 9 years ago
parent
commit
db598bc4f7
3 changed files with 5 additions and 2 deletions
  1. +1
    -0
      HISTORY.md
  2. +2
    -1
      dist/vis.js
  3. +2
    -1
      lib/network/modules/Canvas.js

+ 1
- 0
HISTORY.md View File

@ -8,6 +8,7 @@ http://visjs.org
- Fixed bug where an edge that was not connected would crash the layout algorithms. - Fixed bug where an edge that was not connected would crash the layout algorithms.
- Fixed bug where a box shape could not be drawn outside of the viewable area. - Fixed bug where a box shape could not be drawn outside of the viewable area.
- Fixed bug where dragging a node that is not a control node during edit edge mode would throw an error. - Fixed bug where dragging a node that is not a control node during edit edge mode would throw an error.
- Made autoscaling on container size change pick the lowest between delta height and delta width.
## 2015-09-14, version 4.8.2 ## 2015-09-14, version 4.8.2

+ 2
- 1
dist/vis.js View File

@ -36374,6 +36374,7 @@ return /******/ (function(modules) { // webpackBootstrap
var pixelRatio = arguments.length <= 0 || arguments[0] === undefined ? this.pixelRatio : arguments[0]; var pixelRatio = arguments.length <= 0 || arguments[0] === undefined ? this.pixelRatio : arguments[0];
this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio; this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio;
this.cameraState.previousHeight = this.frame.canvas.height / pixelRatio;
this.cameraState.scale = this.body.view.scale; this.cameraState.scale = this.body.view.scale;
this.cameraState.position = this.DOMtoCanvas({ x: 0.5 * this.frame.canvas.width / pixelRatio, y: 0.5 * this.frame.canvas.height / pixelRatio }); this.cameraState.position = this.DOMtoCanvas({ x: 0.5 * this.frame.canvas.width / pixelRatio, y: 0.5 * this.frame.canvas.height / pixelRatio });
} }
@ -36387,7 +36388,7 @@ return /******/ (function(modules) { // webpackBootstrap
value: function _setCameraState() { value: function _setCameraState() {
if (this.cameraState.scale !== undefined && this.frame.canvas.clientWidth !== 0 && this.frame.canvas.clientHeight !== 0 && this.pixelRatio !== 0 && this.cameraState.previousWidth > 0) { if (this.cameraState.scale !== undefined && this.frame.canvas.clientWidth !== 0 && this.frame.canvas.clientHeight !== 0 && this.pixelRatio !== 0 && this.cameraState.previousWidth > 0) {
this.body.view.scale = this.cameraState.scale * (this.frame.canvas.width / this.pixelRatio / this.cameraState.previousWidth);
this.body.view.scale = this.cameraState.scale * Math.min(this.frame.canvas.width / this.pixelRatio / this.cameraState.previousWidth, this.frame.canvas.height / this.pixelRatio / this.cameraState.previousHeight);
// this comes from the view module. // this comes from the view module.
var currentViewCenter = this.DOMtoCanvas({ var currentViewCenter = this.DOMtoCanvas({

+ 2
- 1
lib/network/modules/Canvas.js View File

@ -89,6 +89,7 @@ class Canvas {
*/ */
_getCameraState(pixelRatio = this.pixelRatio) { _getCameraState(pixelRatio = this.pixelRatio) {
this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio; this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio;
this.cameraState.previousHeight = this.frame.canvas.height / pixelRatio;
this.cameraState.scale = this.body.view.scale; this.cameraState.scale = this.body.view.scale;
this.cameraState.position = this.DOMtoCanvas({x: 0.5 * this.frame.canvas.width / pixelRatio, y: 0.5 * this.frame.canvas.height / pixelRatio}); this.cameraState.position = this.DOMtoCanvas({x: 0.5 * this.frame.canvas.width / pixelRatio, y: 0.5 * this.frame.canvas.height / pixelRatio});
} }
@ -104,7 +105,7 @@ class Canvas {
this.pixelRatio !== 0 && this.pixelRatio !== 0 &&
this.cameraState.previousWidth > 0) { this.cameraState.previousWidth > 0) {
this.body.view.scale = this.cameraState.scale * ((this.frame.canvas.width / this.pixelRatio) / this.cameraState.previousWidth);
this.body.view.scale = this.cameraState.scale * Math.min((this.frame.canvas.width / this.pixelRatio) / this.cameraState.previousWidth,(this.frame.canvas.height / this.pixelRatio) / this.cameraState.previousHeight);
// this comes from the view module. // this comes from the view module.
var currentViewCenter = this.DOMtoCanvas({ var currentViewCenter = this.DOMtoCanvas({

Loading…
Cancel
Save