Browse Source

Fixed node resizing on dragging.

flowchartTest
Alex de Mulder 8 years ago
parent
commit
3ab17e2cb0
8 changed files with 27 additions and 26 deletions
  1. +1
    -0
      HISTORY.md
  2. +13
    -13
      dist/vis.js
  3. +2
    -2
      lib/network/modules/CanvasRenderer.js
  4. +1
    -1
      lib/network/modules/InteractionHandler.js
  5. +1
    -1
      lib/network/modules/components/Node.js
  6. +3
    -3
      lib/network/modules/components/nodes/shapes/Database.js
  7. +3
    -3
      lib/network/modules/components/nodes/shapes/Ellipse.js
  8. +3
    -3
      lib/network/modules/components/nodes/shapes/Text.js

+ 1
- 0
HISTORY.md View File

@ -6,6 +6,7 @@ http://visjs.org
### Network
- Properly fixed the _lockedRedraw method.
- Fixed node resizing on dragging.
## 2015-07-03, version 4.4.0

+ 13
- 13
dist/vis.js View File

@ -27919,7 +27919,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {CanvasRenderingContext2D} ctx
*/
value: function resize(ctx) {
this.shape.resize(ctx);
this.shape.resize(ctx, this.selected);
}
}, {
key: 'isOverlappingWith',
@ -28908,14 +28908,14 @@ return /******/ (function(modules) { // webpackBootstrap
ctx.stroke();
this.updateBoundingBox(x, y, ctx);
this.updateBoundingBox(x, y, ctx, selected);
this.labelModule.draw(ctx, x, y, selected);
}
}, {
key: 'updateBoundingBox',
value: function updateBoundingBox(x, y, ctx) {
this.resize(ctx);
value: function updateBoundingBox(x, y, ctx, selected) {
this.resize(ctx, selected);
this.left = x - this.width * 0.5;
this.top = y - this.height * 0.5;
@ -29229,13 +29229,13 @@ return /******/ (function(modules) { // webpackBootstrap
ctx.stroke();
this.updateBoundingBox(x, y);
this.updateBoundingBox(x, y, ctx, selected);
this.labelModule.draw(ctx, x, y, selected);
}
}, {
key: 'updateBoundingBox',
value: function updateBoundingBox(x, y, ctx) {
this.resize(ctx, false); // just in case
value: function updateBoundingBox(x, y, ctx, selected) {
this.resize(ctx, selected); // just in case
this.left = x - this.width * 0.5;
this.top = y - this.height * 0.5;
@ -29638,12 +29638,12 @@ return /******/ (function(modules) { // webpackBootstrap
// disable shadows for other elements.
this.disableShadow(ctx);
this.updateBoundingBox(x, y);
this.updateBoundingBox(x, y, ctx, selected);
}
}, {
key: 'updateBoundingBox',
value: function updateBoundingBox(x, y) {
this.resize();
value: function updateBoundingBox(x, y, ctx, selected) {
this.resize(ctx, selected);
this.left = x - this.width / 2;
this.top = y - this.height / 2;
@ -34894,7 +34894,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (nodes.hasOwnProperty(nodeId)) {
node = nodes[nodeId];
node.resize(ctx);
node.updateBoundingBox(ctx);
node.updateBoundingBox(ctx, node.selected);
}
}
@ -34938,7 +34938,7 @@ return /******/ (function(modules) { // webpackBootstrap
} else if (node.isBoundingBoxOverlappingWith(viewableArea) === true) {
node.draw(ctx);
} else {
node.updateBoundingBox(ctx);
node.updateBoundingBox(ctx, node.selected);
}
}
}
@ -36216,7 +36216,7 @@ return /******/ (function(modules) { // webpackBootstrap
// if the drag was not started properly because the click started outside the network div, start it now.
if (this.drag.pointer === undefined) {
this._handleDragStart(event);
this.onDragStart(event);
return;
}
var diffX = pointer.x - this.drag.pointer.x;

+ 2
- 2
lib/network/modules/CanvasRenderer.js View File

@ -227,7 +227,7 @@ class CanvasRenderer {
if (nodes.hasOwnProperty(nodeId)) {
node = nodes[nodeId];
node.resize(ctx);
node.updateBoundingBox(ctx);
node.updateBoundingBox(ctx, node.selected);
}
}
@ -271,7 +271,7 @@ class CanvasRenderer {
node.draw(ctx);
}
else {
node.updateBoundingBox(ctx);
node.updateBoundingBox(ctx, node.selected);
}
}
}

+ 1
- 1
lib/network/modules/InteractionHandler.js View File

@ -368,7 +368,7 @@ class InteractionHandler {
// if the drag was not started properly because the click started outside the network div, start it now.
if (this.drag.pointer === undefined) {
this._handleDragStart(event);
this.onDragStart(event);
return;
}
let diffX = pointer.x - this.drag.pointer.x;

+ 1
- 1
lib/network/modules/components/Node.js View File

@ -401,7 +401,7 @@ class Node {
* @param {CanvasRenderingContext2D} ctx
*/
resize(ctx) {
this.shape.resize(ctx);
this.shape.resize(ctx, this.selected);
}

+ 3
- 3
lib/network/modules/components/nodes/shapes/Database.js View File

@ -43,13 +43,13 @@ class Database extends NodeBase {
ctx.stroke();
this.updateBoundingBox(x,y,ctx);
this.updateBoundingBox(x,y,ctx,selected);
this.labelModule.draw(ctx, x, y, selected);
}
updateBoundingBox(x,y,ctx) {
this.resize(ctx);
updateBoundingBox(x,y,ctx, selected) {
this.resize(ctx, selected);
this.left = x - this.width * 0.5;
this.top = y - this.height * 0.5;

+ 3
- 3
lib/network/modules/components/nodes/shapes/Ellipse.js View File

@ -46,12 +46,12 @@ class Ellipse extends NodeBase {
ctx.stroke();
this.updateBoundingBox(x,y);
this.updateBoundingBox(x, y, ctx, selected);
this.labelModule.draw(ctx, x, y, selected);
}
updateBoundingBox(x,y,ctx) {
this.resize(ctx, false); // just in case
updateBoundingBox(x, y, ctx, selected) {
this.resize(ctx, selected); // just in case
this.left = x - this.width * 0.5;
this.top = y - this.height * 0.5;

+ 3
- 3
lib/network/modules/components/nodes/shapes/Text.js View File

@ -29,11 +29,11 @@ class Text extends NodeBase {
// disable shadows for other elements.
this.disableShadow(ctx);
this.updateBoundingBox(x,y);
this.updateBoundingBox(x, y, ctx, selected);
}
updateBoundingBox(x,y) {
this.resize();
updateBoundingBox(x, y, ctx, selected) {
this.resize(ctx, selected);
this.left = x - this.width / 2;
this.top = y - this.height / 2;

Loading…
Cancel
Save