Browse Source

- Fixed bug with the moveTo and getViewPosition methods.

flowchartTest
Alex de Mulder 9 years ago
parent
commit
09d7d4bb53
5 changed files with 32661 additions and 32655 deletions
  1. +1
    -0
      HISTORY.md
  2. +32654
    -32651
      dist/vis.js
  3. +1
    -1
      docs/network/index.html
  4. +4
    -3
      lib/network/modules/View.js
  5. +1
    -0
      lib/network/modules/components/nodes/util/CircleImageBase.js

+ 1
- 0
HISTORY.md View File

@ -11,6 +11,7 @@ http://visjs.org
- Fixed dynamic edges not correctly handling non-existent nodes.
- Accepted pull from @killerDJO for fixing selected and hover colors for edges.
- Fixed bug with rightmouse button, scroll center and popup positions using the wrong coordinates.
- Fixed bug with the moveTo and getViewPosition methods.
### Graph2d & Timeline

+ 32654
- 32651
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
docs/network/index.html View File

@ -1026,7 +1026,7 @@ var locales = {
<code>linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic,
easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint</code>.
<i>You will have to define at least a scale or a position. Otherwise, there is nothing to move
<i>You will have to define at least a scale, position or offset. Otherwise, there is nothing to move
to.</i>
</td>
</tr>

+ 4
- 3
lib/network/modules/View.js View File

@ -184,8 +184,8 @@ class View {
if (options.offset === undefined) {options.offset = {x: 0, y: 0}; }
if (options.offset.x === undefined) {options.offset.x = 0; }
if (options.offset.y === undefined) {options.offset.y = 0; }
if (options.scale === undefined) {options.scale = this.body.view.scale; }
if (options.position === undefined) {options.position = this.body.view.translation;}
if (options.scale === undefined) {options.scale = this.body.view.scale; }
if (options.position === undefined) {options.position = this.getViewPosition();}
if (options.animation === undefined) {options.animation = {duration:0}; }
if (options.animation === false ) {options.animation = {duration:0}; }
if (options.animation === true ) {options.animation = {}; }
@ -231,6 +231,7 @@ class View {
// but at least then we'll have the target transition
this.body.view.scale = this.targetScale;
var viewCenter = this.canvas.DOMtoCanvas({x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight});
console.log('viewCenter', viewCenter,this.body.view.translation, options.position)
var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node
x: viewCenter.x - options.position.x,
y: viewCenter.y - options.position.y
@ -326,7 +327,7 @@ class View {
}
getViewPosition() {
return {x:this.body.view.translation.x, y:this.body.view.translation.y};
return this.canvas.DOMtoCanvas({x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight});
}

+ 1
- 0
lib/network/modules/components/nodes/util/CircleImageBase.js View File

@ -75,6 +75,7 @@ class CircleImageBase extends NodeBase {
}
_drawImageAtPosition(ctx) {
console.log(this.options.label, this.imageObj.width)
if (this.imageObj.width != 0) {
// draw the image
ctx.globalAlpha = 1.0;

Loading…
Cancel
Save