Skip to content

Commit

Permalink
Merge pull request #765 from webgme/revert-732-725-enhancement/smooth…
Browse files Browse the repository at this point in the history
…-connection-updates

Revert "Added animation functionality. Fixes #725"
  • Loading branch information
Patrik Meijer committed Dec 21, 2015
2 parents e70c465 + ad98066 commit 746dc10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
13 changes: 3 additions & 10 deletions src/client/js/Widgets/DiagramDesigner/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ define([
SHADOW_MARKER_SIZE_INCREMENT = 3,
SHADOW_MARKER_SIZE_INCREMENT_X = 1,
SHADOW_MARKER_BLOCK_FIX_OFFSET = 2,
ANIMATION_DURATION = 500,
JUMP_XING_RADIUS = 3;

Connection = function (objId) {
Expand Down Expand Up @@ -351,7 +350,7 @@ define([
return p;
};

Connection.prototype.setConnectionRenderData = function (segPoints, animate) {
Connection.prototype.setConnectionRenderData = function (segPoints) {
var i = 0,
len,
pathDef = [],
Expand Down Expand Up @@ -451,13 +450,7 @@ define([

if (this.skinParts.path) {
this.logger.debug('Redrawing connection with ID: "' + this.id + '"');
if (animate) {
this.skinParts.path.animate({path: pathDef}, ANIMATION_DURATION);
setTimeout(this._renderTexts.bind(this), ANIMATION_DURATION);
} else {
this.skinParts.path.attr({path: pathDef});
}

this.skinParts.path.attr({path: pathDef});
if (this.skinParts.pathShadow) {
this._updatePathShadow(this._pathPoints);
}
Expand Down Expand Up @@ -496,8 +489,8 @@ define([
}

this._showConnectionAreaMarker();
this._renderTexts();

this._renderTexts();
} else {
this.pathDef = null;
this._removePath();
Expand Down
28 changes: 12 additions & 16 deletions src/client/js/Widgets/DiagramDesigner/ConnectionRouteManager3.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,15 @@ define([
ConnectionRouteManager3.prototype.redrawConnections = function () {

var disconnectedIds = [],
id,
conns;

id;
for (var i = this._movedItems.length; i--;) {
id = this._movedItems[i];
conns = this._pathsForItem[id] || [];
for (var j = conns.length; j--;) {
disconnectedIds.push(conns[j]);
this._movedPaths[conns[j]] = true;
if (this._pathsForItem[id]) {
disconnectedIds = disconnectedIds.concat(this._pathsForItem[id]);
}
}
this.simpleRouter.redrawSomeConnections(disconnectedIds);
this._movedItems = [];
this.simpleRouter.redrawSomeConnections(disconnectedIds);

if (!this._initialized) {
this._initializeGraph();
Expand Down Expand Up @@ -331,10 +327,7 @@ define([
*/
ConnectionRouteManager3.prototype._renderConnection = function (id, points) {
if (this.diagramDesigner.items[id]) { // Only render if the box still exists
// Check if it was a moved connection
var animate = !this._movedPaths[id];
this.diagramDesigner.items[id].setConnectionRenderData(points, animate);
delete this._movedPaths[id];
this.diagramDesigner.items[id].setConnectionRenderData(points);
}
};

Expand All @@ -348,7 +341,6 @@ define([

this._pathsForItem = {};
this._movedItems = [];
this._movedPaths = {};
};

ConnectionRouteManager3.prototype._initializeGraph = function () {
Expand Down Expand Up @@ -384,8 +376,12 @@ define([
ConnectionRouteManager3.prototype._getBoxIdsFor = function(connId) {
var canvas = this.diagramDesigner,
srcObjId = canvas.connectionEndIDs[connId].srcObjId,
dstObjId = canvas.connectionEndIDs[connId].dstObjId;
return [srcObjId, dstObjId];
srcSubCompId = canvas.connectionEndIDs[connId].srcSubCompId,
dstObjId = canvas.connectionEndIDs[connId].dstObjId,
dstSubCompId = canvas.connectionEndIDs[connId].dstSubCompId,
sId = srcSubCompId ? srcObjId + DESIGNERITEM_SUBCOMPONENT_SEPARATOR + srcSubCompId : srcObjId,
tId = dstSubCompId ? dstObjId + DESIGNERITEM_SUBCOMPONENT_SEPARATOR + dstSubCompId : dstObjId;
return [sId, tId];
};

ConnectionRouteManager3.prototype.insertConnection = function (connId) {
Expand Down Expand Up @@ -422,7 +418,7 @@ define([
this._invokeAutoRouterMethod('addPath',
[{src: srcPorts, dst: dstPorts}, connId]);
// Record the path
this.recordPathFor(connId, srcObjId, dstObjId);
this.recordPathFor(connId, sId, tId);
}

//Set custom points, if applicable
Expand Down

0 comments on commit 746dc10

Please sign in to comment.