Skip to content

Commit

Permalink
refactor(dia.Paper)!: change the default connection point to \'bounda…
Browse files Browse the repository at this point in the history
…ry\' (#2489)
  • Loading branch information
kumilingus authored Jan 19, 2024
1 parent 72ce832 commit df012f3
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 87 deletions.
1 change: 0 additions & 1 deletion packages/joint-core/demo/archive/petri-nets/src/pn.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ var paper = new joint.dia.Paper({
cellViewNamespace: shapes,
linkView: joint.dia.LegacyLinkView,
defaultAnchor: { name: 'perpendicular' },
defaultConnectionPoint: { name: 'boundary' },
model: graph
});

Expand Down
3 changes: 0 additions & 3 deletions packages/joint-core/demo/bandwidth/src/bandwidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const paper = new dia.Paper({
cellViewNamespace: shapes,
async: true,
background: { color: '#F3F7F6' },
defaultConnectionPoint: {
name: 'boundary',
},
restrictTranslate: (elementView) => {
// Restrict the element movement along the line only
const { height } = elementView.model.size();
Expand Down
3 changes: 0 additions & 3 deletions packages/joint-core/demo/container/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
color: '#F3F7F6'
},
interactive: { linkMove: false },
defaultConnectionPoint: {
name: 'boundary'
},
viewport: function(view) {
var element = view.model;
// Hide any element or link which is embedded inside a collapsed parent (or parent of the parent).
Expand Down
1 change: 0 additions & 1 deletion packages/joint-core/demo/devs/src/shapes.devs.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ const paper = new dia.Paper({
embeddingMode: true,
clickThreshold: 5,
cellViewNamespace: shapes,
defaultConnectionPoint: { name: 'boundary' },
overflow: true,
highlighting: {
'default': {
Expand Down
1 change: 0 additions & 1 deletion packages/joint-core/demo/expand/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ var paper = new joint.dia.ExpandPaper({
model: graph,
cellViewNamespace: joint.shapes,
defaultLink: new appLink(),
defaultConnectionPoint: { name: 'boundary' },
magnetThreshold: 'onleave',
clickThreshold: 5,
validateMagnet: function(cellView, magnet) {
Expand Down
1 change: 0 additions & 1 deletion packages/joint-core/demo/fsa/src/fsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const paper = new joint.dia.Paper({
height: 600,
model: graph,
cellViewNamespace: joint.shapes,
defaultConnectionPoint: { name: 'boundary' },
defaultConnector: { name: 'smooth' },
interactive: { linkMove: false },
labelsLayer: true,
Expand Down
2 changes: 0 additions & 2 deletions packages/joint-core/demo/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ var paper = new joint.dia.Paper({
height: 600,
model: graph,
cellViewNamespace: joint.shapes,
defaultConnectionPoint: { name: 'boundary' }
});

//var a, aa, aaa, b, c, d, e, f, g, h, t, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17;
Expand Down Expand Up @@ -149,7 +148,6 @@ var treePaper = new joint.dia.Paper({
height: 600,
model: treeGraph,
cellViewNamespace: joint.shapes,
defaultConnectionPoint: { name: 'boundary' }
});

treePaper.on('cell:mouseover', info);
Expand Down
1 change: 0 additions & 1 deletion packages/joint-core/demo/performance/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ var paper = new Paper({
async: true,
frozen: true,
defaultAnchor: { name: 'modelCenter' },
defaultConnectionPoint: { name: 'boundary' },
viewport: function(view, isInViewport) {
if (leaveDraggedInViewport && view.cid === draggedCid) return true;
if (leaveRenderedInViewport && isInViewport) return true;
Expand Down
1 change: 0 additions & 1 deletion packages/joint-core/demo/ports/dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ var paper = new joint.dia.Paper({
snapLinks: true,
defaultLink: new joint.shapes.standard.Link({ z: - 1 }),
defaultConnector: { name: 'smooth' },
defaultConnectionPoint: { name: 'boundary' },
markAvailable: true,
validateConnection: function(vS, mS, vT, mT, end, lV) {
if (!mT) return false;
Expand Down
1 change: 0 additions & 1 deletion packages/joint-core/demo/ports/ports2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ new joint.dia.Paper({
gridSize: 1,
model: graph,
cellViewNamespace: joint.shapes,
defaultConnectionPoint: { name: 'boundary' }
});

var m1 = new joint.shapes.standard.Rectangle({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
});</code></pre>

<p>The default connection point is <code>'bbox'</code>; this can be changed with the <code>defaultConnectionPoint</code> <a href="#dia.Paper.prototype.options.defaultConnectionPoint">paper option</a>. Example:</p>
<p>The default connection point is <code>'boundary'</code>; this can be changed with the <code>defaultConnectionPoint</code> <a href="#dia.Paper.prototype.options.defaultConnectionPoint">paper option</a>. Example:</p>

<pre><code>paper.options.defaultConnectionPoint = {
name: 'boundary',
Expand Down
2 changes: 1 addition & 1 deletion packages/joint-core/src/dia/Paper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export const Paper = View.extend({

defaultLinkAnchor: { name: 'connectionRatio' },

defaultConnectionPoint: { name: 'bbox' },
defaultConnectionPoint: { name: 'boundary' },

/* CONNECTING */

Expand Down
1 change: 1 addition & 0 deletions packages/joint-core/test/jointjs/connectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ QUnit.module('connectors', function(hooks) {
gridSize: 10,
model: this.graph,
cellViewNamespace: joint.shapes,
defaultConnectionPoint: { name: 'bbox' },
});
});

Expand Down
1 change: 1 addition & 0 deletions packages/joint-core/test/jointjs/routers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ QUnit.module('routers', function(hooks) {
gridSize: 10,
model: this.graph,
cellViewNamespace: joint.shapes,
defaultConnectionPoint: { name: 'bbox' },
});
});

Expand Down
15 changes: 7 additions & 8 deletions packages/joint-core/tutorials/js/ports-basic-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

var namespace = joint.shapes;
var graph = new joint.dia.Graph({}, { cellNamespace: namespace });
new joint.dia.Paper({
new joint.dia.Paper({
el: document.getElementById('paper-basic-groups'),
width: 650,
height: 200,
gridSize: 1,
model: graph,
model: graph,
cellViewNamespace: namespace,
linkPinning: false, // Prevent link being dropped in blank paper area
defaultLink: () => new joint.shapes.standard.Link(),
defaultConnectionPoint: { name: 'boundary' },
validateConnection: function(cellViewS, magnetS, cellViewT, magnetT, end, linkView) {
// Prevent linking between ports within one element
if (cellViewS === cellViewT) return false;
Expand All @@ -34,7 +33,7 @@
label: {
position: {
name: 'left',
args: { y: 6 }
args: { y: 6 }
},
markup: [{
tagName: 'text',
Expand Down Expand Up @@ -85,7 +84,7 @@
body: {
fill: '#8ECAE6',
},
label: {
label: {
text: 'Model',
fontSize: 16,
y: -10
Expand All @@ -101,15 +100,15 @@


model.addPorts([
{
{
group: 'in',
attrs: { label: { text: 'in1' }}
},
{
{
group: 'in',
attrs: { label: { text: 'in2' }}
},
{
{
group: 'out',
attrs: { label: { text: 'out' }}
}
Expand Down
15 changes: 7 additions & 8 deletions packages/joint-core/tutorials/js/ports-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

var namespace = joint.shapes;
var graph = new joint.dia.Graph({}, { cellNamespace: namespace });
new joint.dia.Paper({
new joint.dia.Paper({
el: document.getElementById('paper-basic'),
width: 650,
height: 200,
gridSize: 1,
model: graph,
model: graph,
cellViewNamespace: namespace,
linkPinning: false, // Prevent link being dropped in blank paper area
defaultLink: () => new joint.shapes.standard.Link(),
defaultConnectionPoint: { name: 'boundary' },
validateConnection: function(cellViewS, magnetS, cellViewT, magnetT, end, linkView) {
// Prevent linking between ports within one element
if (cellViewS === cellViewT) return false;
Expand All @@ -28,17 +27,17 @@
selector: 'label'
}]
},
attrs: {
portBody: {
attrs: {
portBody: {
magnet: true,
width: 16,
height: 16,
x: -8,
y: -8,
fill: '#03071E'
},
label: {
text: 'port'
},
label: {
text: 'port'
}
},
markup: [{
Expand Down
23 changes: 11 additions & 12 deletions packages/joint-core/tutorials/js/ports-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

var namespace = joint.shapes;
var graph = new joint.dia.Graph({}, { cellNamespace: namespace });
var paper = new joint.dia.Paper({
var paper = new joint.dia.Paper({
el: document.getElementById('paper-layout'),
width: 650,
height: 200,
gridSize: 1,
model: graph,
model: graph,
cellViewNamespace: namespace,
linkPinning: false, // Prevent link being dropped in blank paper area
defaultLink: () => new joint.shapes.standard.Link({
Expand All @@ -17,7 +17,6 @@
}
}
}),
defaultConnectionPoint: { name: 'boundary' },
validateConnection: function(cellViewS, magnetS, cellViewT, magnetT, end, linkView) {
// Prevent loop linking
return (magnetS !== magnetT);
Expand All @@ -40,7 +39,7 @@
label: {
position: {
name: 'left',
args: { y: 6 }
args: { y: 6 }
},
markup: [{
tagName: 'text',
Expand Down Expand Up @@ -183,7 +182,7 @@
body: {
fill: '#8ECAE6'
},
label: {
label: {
text: 'Model 2',
fontSize: 16,
y: -10
Expand All @@ -199,15 +198,15 @@


model1.addPorts([
{
{
group: 'in',
attrs: { label: { text: 'in1' }}
},
{
{
group: 'in',
attrs: { label: { text: 'in2' }}
},
{
{
group: 'in',
attrs: { label: { text: 'in3' }}
},
Expand All @@ -218,15 +217,15 @@
]);

model2.addPorts([
{
{
group: 'in',
attrs: { label: { text: 'in1' }}
},
{
{
group: 'in',
attrs: { label: { text: 'in2' }}
},
{
{
group: 'out',
attrs: { label: { text: 'out' }}
}
Expand All @@ -238,7 +237,7 @@
paper.on('link:mouseenter', (linkView) => {
showLinkTools(linkView);
});

paper.on('link:mouseleave', (linkView) => {
linkView.removeTools();
});
Expand Down
17 changes: 8 additions & 9 deletions packages/joint-core/tutorials/js/ports-link-snapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

var namespace = joint.shapes;
var graph = new joint.dia.Graph({}, { cellNamespace: namespace });
var paper = new joint.dia.Paper({
var paper = new joint.dia.Paper({
el: document.getElementById('paper-link-snapping'),
width: 650,
height: 200,
gridSize: 1,
model: graph,
model: graph,
cellViewNamespace: namespace,
linkPinning: false, // Prevent link being dropped in blank paper area
defaultLink: () => new joint.shapes.standard.Link({
Expand All @@ -17,7 +17,6 @@
}
}
}),
defaultConnectionPoint: { name: 'boundary' },
validateConnection: function(cellViewS, magnetS, cellViewT, magnetT, end, linkView) {
// Prevent loop linking
return (magnetS !== magnetT);
Expand All @@ -42,7 +41,7 @@
label: {
position: {
name: 'left',
args: { y: 6 }
args: { y: 6 }
},
markup: [{
tagName: 'text',
Expand Down Expand Up @@ -96,7 +95,7 @@
body: {
fill: '#8ECAE6',
},
label: {
label: {
text: 'Model',
fontSize: 16,
y: -10
Expand All @@ -112,15 +111,15 @@


model.addPorts([
{
{
group: 'in',
attrs: { label: { text: 'in1' }}
},
{
{
group: 'in',
attrs: { label: { text: 'in2' }}
},
{
{
group: 'out',
attrs: { label: { text: 'out' }}
}
Expand All @@ -134,7 +133,7 @@
paper.on('link:mouseenter', (linkView) => {
showLinkTools(linkView);
});

paper.on('link:mouseleave', (linkView) => {
linkView.removeTools();
});
Expand Down
Loading

0 comments on commit df012f3

Please sign in to comment.