diff --git a/HISTORY.md b/HISTORY.md index da180ac9..60a0bf8c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 diff --git a/dist/vis.js b/dist/vis.js index 93bc37ce..eee70eb0 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -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; diff --git a/lib/network/modules/CanvasRenderer.js b/lib/network/modules/CanvasRenderer.js index 2df8e5a9..51653c2b 100644 --- a/lib/network/modules/CanvasRenderer.js +++ b/lib/network/modules/CanvasRenderer.js @@ -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); } } } diff --git a/lib/network/modules/InteractionHandler.js b/lib/network/modules/InteractionHandler.js index 0845c12b..831dde5e 100644 --- a/lib/network/modules/InteractionHandler.js +++ b/lib/network/modules/InteractionHandler.js @@ -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; diff --git a/lib/network/modules/components/Node.js b/lib/network/modules/components/Node.js index 4a4ba84a..2ff22d70 100644 --- a/lib/network/modules/components/Node.js +++ b/lib/network/modules/components/Node.js @@ -401,7 +401,7 @@ class Node { * @param {CanvasRenderingContext2D} ctx */ resize(ctx) { - this.shape.resize(ctx); + this.shape.resize(ctx, this.selected); } diff --git a/lib/network/modules/components/nodes/shapes/Database.js b/lib/network/modules/components/nodes/shapes/Database.js index 66d168b6..6c9a10bf 100644 --- a/lib/network/modules/components/nodes/shapes/Database.js +++ b/lib/network/modules/components/nodes/shapes/Database.js @@ -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; diff --git a/lib/network/modules/components/nodes/shapes/Ellipse.js b/lib/network/modules/components/nodes/shapes/Ellipse.js index f422292a..f263358d 100644 --- a/lib/network/modules/components/nodes/shapes/Ellipse.js +++ b/lib/network/modules/components/nodes/shapes/Ellipse.js @@ -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; diff --git a/lib/network/modules/components/nodes/shapes/Text.js b/lib/network/modules/components/nodes/shapes/Text.js index 7a28ef77..4f0fb81a 100644 --- a/lib/network/modules/components/nodes/shapes/Text.js +++ b/lib/network/modules/components/nodes/shapes/Text.js @@ -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;