@joint/core 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/geometry.js +1 -1
- package/dist/geometry.min.js +1 -1
- package/dist/joint.d.ts +3 -1
- package/dist/joint.js +37 -13
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +37 -13
- package/dist/joint.nowrap.min.js +2 -2
- package/dist/vectorizer.js +1 -1
- package/dist/vectorizer.min.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +3 -2
- package/src/dia/CellView.mjs +11 -6
- package/src/dia/layers/GridLayer.mjs +6 -2
- package/src/dia/ports.mjs +7 -0
- package/src/linkTools/Arrowhead.mjs +3 -1
- package/src/mvc/View.mjs +9 -7
- package/types/joint.d.ts +2 -0
package/dist/vectorizer.js
CHANGED
package/dist/vectorizer.min.js
CHANGED
package/dist/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joint/core",
|
|
3
3
|
"title": "JointJS",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.3",
|
|
5
5
|
"description": "JavaScript diagramming library",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/joint.min.js",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
+
"prepublishOnly": "echo \"Publishing via NPM is not allowed!\" && exit 1",
|
|
40
41
|
"prepack": "yarn run dist",
|
|
41
42
|
"build": "grunt install",
|
|
42
43
|
"test": "grunt test",
|
|
@@ -188,4 +189,4 @@
|
|
|
188
189
|
"finder",
|
|
189
190
|
"shortest-path-finder"
|
|
190
191
|
]
|
|
191
|
-
}
|
|
192
|
+
}
|
package/src/dia/CellView.mjs
CHANGED
|
@@ -433,15 +433,20 @@ export const CellView = View.extend({
|
|
|
433
433
|
|
|
434
434
|
getLinkEnd: function(magnet, ...args) {
|
|
435
435
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
const model = this.model;
|
|
437
|
+
const id = model.id;
|
|
438
|
+
// Find a node with the `port` attribute set on it.
|
|
439
|
+
const portNode = this.findAttributeNode('port', magnet);
|
|
439
440
|
// Find a unique `selector` of the element under pointer that is a magnet.
|
|
440
|
-
|
|
441
|
+
const selector = magnet.getAttribute('joint-selector');
|
|
441
442
|
|
|
442
|
-
|
|
443
|
+
const end = { id: id };
|
|
443
444
|
if (selector != null) end.magnet = selector;
|
|
444
|
-
if (
|
|
445
|
+
if (portNode != null) {
|
|
446
|
+
let port = portNode.getAttribute('port');
|
|
447
|
+
if (portNode.getAttribute('port-id-type') === 'number') {
|
|
448
|
+
port = parseInt(port, 10);
|
|
449
|
+
}
|
|
445
450
|
end.port = port;
|
|
446
451
|
if (!model.hasPort(port) && !selector) {
|
|
447
452
|
// port created via the `port` attribute (not API)
|
|
@@ -67,7 +67,7 @@ export const GridLayer = PaperLayer.extend({
|
|
|
67
67
|
|
|
68
68
|
gridSettings.forEach((gridLayerSetting, index) => {
|
|
69
69
|
|
|
70
|
-
const id =
|
|
70
|
+
const id = this._getPatternId(index);
|
|
71
71
|
const options = merge({}, gridLayerSetting);
|
|
72
72
|
const { scaleFactor = 1 } = options;
|
|
73
73
|
options.width = gridSize * scaleFactor || 1;
|
|
@@ -107,12 +107,16 @@ export const GridLayer = PaperLayer.extend({
|
|
|
107
107
|
}
|
|
108
108
|
gridSettings.forEach((options, index) => {
|
|
109
109
|
if (isFunction(options.update)) {
|
|
110
|
-
const vPattern = patterns[
|
|
110
|
+
const vPattern = patterns[this._getPatternId(index)];
|
|
111
111
|
options.update(vPattern.node.firstChild, options, paper);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
},
|
|
115
115
|
|
|
116
|
+
_getPatternId(index) {
|
|
117
|
+
return `pattern_${this.options.paper.cid}_${index}`;
|
|
118
|
+
},
|
|
119
|
+
|
|
116
120
|
_getGridRefs() {
|
|
117
121
|
let { _gridCache: grid } = this;
|
|
118
122
|
if (grid) return grid;
|
package/src/dia/ports.mjs
CHANGED
|
@@ -731,6 +731,13 @@ export const elementViewPortPrototype = {
|
|
|
731
731
|
'port-group': port.group
|
|
732
732
|
});
|
|
733
733
|
|
|
734
|
+
// If the port ID is a number, we need to add
|
|
735
|
+
// extra information to the port element to distinguish
|
|
736
|
+
// between ports with the same ID but different types.
|
|
737
|
+
if (util.isNumber(port.id)) {
|
|
738
|
+
portElement.attr('port-id-type', 'number');
|
|
739
|
+
}
|
|
740
|
+
|
|
734
741
|
const labelMarkupDef = this._getPortLabelMarkup(port.label);
|
|
735
742
|
if (Array.isArray(labelMarkupDef)) {
|
|
736
743
|
// JSON Markup
|
|
@@ -48,12 +48,14 @@ const Arrowhead = ToolView.extend({
|
|
|
48
48
|
evt.stopPropagation();
|
|
49
49
|
evt.preventDefault();
|
|
50
50
|
var relatedView = this.relatedView;
|
|
51
|
+
var paper = relatedView.paper;
|
|
51
52
|
relatedView.model.startBatch('arrowhead-move', { ui: true, tool: this.cid });
|
|
52
53
|
relatedView.startArrowheadMove(this.arrowheadType);
|
|
53
54
|
this.delegateDocumentEvents();
|
|
54
|
-
|
|
55
|
+
paper.undelegateEvents();
|
|
55
56
|
this.focus();
|
|
56
57
|
this.el.style.pointerEvents = 'none';
|
|
58
|
+
relatedView.notifyPointerdown(...paper.getPointerArgs(evt));
|
|
57
59
|
},
|
|
58
60
|
onPointerMove: function(evt) {
|
|
59
61
|
var normalizedEvent = util.normalizeEvent(evt);
|
package/src/mvc/View.mjs
CHANGED
|
@@ -63,23 +63,25 @@ export const View = ViewBase.extend({
|
|
|
63
63
|
return this;
|
|
64
64
|
},
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var currentNode = node;
|
|
69
|
-
|
|
66
|
+
findAttributeNode: function(attributeName, node) {
|
|
67
|
+
let currentNode = node;
|
|
70
68
|
while (currentNode && currentNode.nodeType === 1) {
|
|
71
|
-
var attributeValue = currentNode.getAttribute(attributeName);
|
|
72
69
|
// attribute found
|
|
73
|
-
|
|
70
|
+
// (empty value does not count as attribute found)
|
|
71
|
+
if (currentNode.getAttribute(attributeName)) return currentNode;
|
|
74
72
|
// do not climb up the DOM
|
|
75
73
|
if (currentNode === this.el) return null;
|
|
76
74
|
// try parent node
|
|
77
75
|
currentNode = currentNode.parentNode;
|
|
78
76
|
}
|
|
79
|
-
|
|
80
77
|
return null;
|
|
81
78
|
},
|
|
82
79
|
|
|
80
|
+
findAttribute: function(attributeName, node) {
|
|
81
|
+
const matchedNode = this.findAttributeNode(attributeName, node);
|
|
82
|
+
return matchedNode && matchedNode.getAttribute(attributeName);
|
|
83
|
+
},
|
|
84
|
+
|
|
83
85
|
// Override the mvc ViewBase `_ensureElement()` method in order to create an
|
|
84
86
|
// svg element (e.g., `<g>`) node that wraps all the nodes of the Cell view.
|
|
85
87
|
// Expose class name setter as a separate method.
|
package/types/joint.d.ts
CHANGED