Skip to content

Commit

Permalink
2.1.4 final
Browse files Browse the repository at this point in the history
  • Loading branch information
sporritt committed Jun 10, 2016
1 parent c8033c8 commit 14bd7d9
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 35 deletions.
4 changes: 2 additions & 2 deletions bower.json
@@ -1,6 +1,6 @@
{
"name": "jsPlumb",
"version": "2.1.3",
"version": "2.1.4",
"ignore": [
"demo",
"dist/apidocs",
Expand Down Expand Up @@ -31,7 +31,7 @@
"test"
],
"main": [
"dist/js/jsPlumb-2.1.3.js"
"dist/js/jsPlumb-2.1.4.js"
],
"homepage": "http://jsplumbtoolkit.com",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion dist/apidocs/data.json
Expand Up @@ -2,7 +2,7 @@
"project": {
"name": "jsplumb",
"description": "Visual connectivity for webapps",
"version": "2.1.3",
"version": "2.1.4",
"url": ""
},
"files": {
Expand Down
20 changes: 12 additions & 8 deletions dist/demo/groups/demo.js
@@ -1,6 +1,6 @@
jsPlumb.ready(function () {

var j = jsPlumb.getInstance({Container:canvas, Connector:"StateMachine", Endpoint:["Dot", {radius:3}], Anchor:"Center"});
var j = window.j = jsPlumb.getInstance({Container:canvas, Connector:"StateMachine", Endpoint:["Dot", {radius:3}], Anchor:"Center"});

j.bind("connection", function(p) {
p.connection.bind("click", function() {
Expand Down Expand Up @@ -31,6 +31,15 @@ jsPlumb.ready(function () {
_appendEvent("group:remove", p.group.id);
});

// connect some before configuring group
j.connect({source:c1_1, target:c2_1});
j.connect({source:c2_1, target:c3_1});
j.connect({source:c2_2, target:c6_2});
j.connect({source:c3_1, target:c4_1});
j.connect({source:c4_1, target:c5_1});
j.connect({source:c1_1,target:c1_2});
j.connect({source:c2_1,target:c2_2});

// NOTE ordering here. we make one draggable before adding it to the group, and we add the other to the group
//before making it draggable. they should both be constrained to the group extents.
j.draggable(c1_1);
Expand All @@ -46,6 +55,7 @@ jsPlumb.ready(function () {
j.addToGroup("one", c1_2);
j.draggable(c1_2);


j.draggable(c2_1);
j.addGroup({
el:container2,
Expand Down Expand Up @@ -113,13 +123,7 @@ jsPlumb.ready(function () {
// the independent element that demonstrates the fact that it can be dropped onto a group
j.draggable("standalone");

j.connect({source:c1_1, target:c2_1});
j.connect({source:c2_1, target:c3_1});
j.connect({source:c2_2, target:c6_2});
j.connect({source:c3_1, target:c4_1});
j.connect({source:c4_1, target:c5_1});
j.connect({source:c1_1,target:c1_2});
j.connect({source:c2_1,target:c2_2});
//... and connect others afterwards.
j.connect({source:c3_1,target:c3_2});
j.connect({source:c4_1,target:c4_2});
j.connect({source:c5_1,target:c5_2});
Expand Down
10 changes: 9 additions & 1 deletion dist/doc/changelog.html
Expand Up @@ -123,7 +123,15 @@
</ul>
</div>
<div class="markdown-body col-xs-9">
<h2>2.1.3</h2>
<h2>2.1.4</h2>

<ul>
<li>issue 530 - Further fix related to issue 530, in which elements that had connections prior to being added to a group
were sometimes getting an offset applied when dragging. The fix for this removed some code that was put in for issue 231,
but it turns out the fix for issue 231 had broken somewhere along the line and this change set that right too.</li>
</ul>

<h2>2.1.3</h2>

<ul>
<li>issue 530 - Element with existing connections being added to Groups.</li>
Expand Down

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions dist/js/jsPlumb-2.1.3.js → dist/js/jsPlumb-2.1.4.js
Expand Up @@ -3680,16 +3680,11 @@
var dragEvent = jsPlumb.dragEvents.drag,
stopEvent = jsPlumb.dragEvents.stop,
startEvent = jsPlumb.dragEvents.start,
_del = _currentInstance.getElement(element),
_ancestor = _currentInstance.getDragManager().getDragAncestor(_del),
_noOffset = {left: 0, top: 0},
_ancestorOffset = _noOffset,
_started = false;

_manage(id, element);

options[startEvent] = _ju.wrap(options[startEvent], function () {
_ancestorOffset = _ancestor != null ? _currentInstance.getOffset(_ancestor) : _noOffset;
_currentInstance.setHoverSuspended(true);
_currentInstance.select({source: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
_currentInstance.select({target: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
Expand All @@ -3703,10 +3698,6 @@
// differs from getUIPosition so much
var ui = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom());
if (ui != null) {
// adjust by ancestor offset if there is one: this is for the case that a draggable
// is contained inside some other element that is not the Container.
ui.left += _ancestorOffset.left;
ui.top += _ancestorOffset.top;
_draw(element, ui, null, true);
if (_started) _currentInstance.addClass(element, "jsplumb-dragged");
_started = true;
Expand All @@ -3728,7 +3719,6 @@
for (var i = 0; i < elements.length; i++)
_one(elements[i]);

// this is common across all
_started = false;
_currentInstance.setHoverSuspended(false);
_currentInstance.setConnectionBeingDragged(false);
Expand Down Expand Up @@ -4536,14 +4526,9 @@
fireDetachEvent(c, params.fireEvent === false ? false : !c.pending, params.originalEvent);
var doNotCleanup = params.deleteAttachedObjects == null ? null : !params.deleteAttachedObjects;

// SP GROUPS. this works but blows up lots of original tests
c.endpoints[0].detachFromConnection(c, null, doNotCleanup);
c.endpoints[1].detachFromConnection(c, null, doNotCleanup);

// SP GROUPS. this does not work but makes all the original tests work.
//c.endpoints[0].detachFromConnection(c);
//c.endpoints[1].detachFromConnection(c);

c.cleanup(true);
c.destroy(true);
}
Expand Down
19 changes: 14 additions & 5 deletions dist/tests/jsPlumb-tests.js
Expand Up @@ -9088,20 +9088,29 @@ test("endpoint: suspendedElement set correctly", function() {
});

test("add elements that already have connections to a group", function() {
var d1 = _addDiv("d1"), d2 = _addDiv("d2"),
var d1 = _addDiv("d1"), d2 = _addDiv("d2"), d3 = _addDiv("d3"),
c = _jsPlumb.connect({source:d1, target:d2}),
c2 = _jsPlumb.connect({source:d1, target:d3}),
g = _addDiv("group");

equal(2, _jsPlumb.select().length, "there are two connections");

var group = _jsPlumb.addGroup({
el:g
});

// add d1; it has a connection
group.add(d1);
// collapse the group. the connection from d1 should be proxied.
// add d1; it has a connection to outside and also one to d3, which will be inside the group. add d3.
group.add(d1); group.add(d3);
// collapse the group. the connection from d1 should be proxied. the connection from d3 should not.
_jsPlumb.collapseGroup(group);
equal(2, _jsPlumb.select().length, "there are two connections");
// test for proxied
equal("d1", c.proxies[0].originalEp.elementId, "endpoint was proxied after collapse");
// test for proxied
equal("d1", c2.endpoints[0].elementId, "endpoint to internal element was not proxied after collapse");
equal("d3", c2.endpoints[1].elementId, "endpoint to internal element was not proxied after collapse");
equal(null, c2.proxies, "connection 2 did not get proxies added");

// expand and test proxy was cleared
_jsPlumb.expandGroup(group);
ok(c.proxies[0] == null, "proxies removed after expand");
Expand All @@ -9120,7 +9129,7 @@ test("endpoint: suspendedElement set correctly", function() {
_jsPlumb.collapseGroup(group);
// test for proxied
equal("d1", c.proxies[0].originalEp.elementId, "endpoint was proxied after collapse");
equal(1, group.getMembers().length, "one member in group");
equal(2, group.getMembers().length, "two members in group");

group.removeAll();
equal(0, group.getMembers().length, "no members in group");
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "jsplumb",
"version": "2.1.3",
"version": "2.1.4",
"description": "Visual connectivity for webapps",
"main": "dist/js/jsPlumb-2.1.3.js",
"main": "dist/js/jsPlumb-2.1.4.js",
"directories": {
"doc": "doc",
"test": "tests"
Expand Down

0 comments on commit 14bd7d9

Please sign in to comment.