@reltio/graph 1.4.1585 → 1.4.1586-mui5

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.
Files changed (164) hide show
  1. package/index.ts +1 -0
  2. package/package.json +26 -9
  3. package/public/bundle.js +205 -0
  4. package/public/bundle.js.LICENSE.txt +88 -0
  5. package/public/package.json +29 -0
  6. package/scripts/build/index.js +20 -0
  7. package/src/__tests__/GraphView.test.tsx +25 -0
  8. package/src/components/CircleLayout/CircleLayout.tsx +76 -0
  9. package/src/components/CircleLayout/__tests__/CircleLayout.test.tsx +194 -0
  10. package/src/components/GotoButton/GotoButton.tsx +23 -0
  11. package/src/components/GotoButton/__tests__/GotoButton.test.tsx +33 -0
  12. package/src/components/GotoButton/styles.ts +15 -0
  13. package/src/components/GraphArea/GraphArea.tsx +113 -0
  14. package/src/components/GraphArea/__tests__/GraphArea.test.tsx +202 -0
  15. package/src/components/GraphArea/styles.ts +30 -0
  16. package/src/components/GraphLayoutSelector/GraphLayoutSelector.tsx +43 -0
  17. package/src/components/GraphLayoutSelector/__tests__/GraphLayoutSelector.spec.tsx +44 -0
  18. package/src/components/GraphLayoutSelector/styles.ts +15 -0
  19. package/src/components/GraphPerspectiveView/GraphPerspectiveView.tsx +58 -0
  20. package/src/components/GraphPerspectiveView/__tests__/GraphPerspectiveView.test.tsx +115 -0
  21. package/src/components/GraphPerspectiveView/__tests__/useGraphLoader.test.tsx +1519 -0
  22. package/src/components/GraphPerspectiveView/__tests__/useRelationshipTable.test.tsx +1003 -0
  23. package/src/components/GraphPerspectiveView/__tests__/useSelectedEntity.test.tsx +373 -0
  24. package/src/components/GraphPerspectiveView/styles.ts +34 -0
  25. package/src/components/GraphRightSidePanel/GraphRightSidePanel.tsx +27 -0
  26. package/src/components/GraphRightSidePanel/__tests__/GraphRightSidePanel.test.tsx +18 -0
  27. package/src/components/GraphRightSidePanel/icons/relationship-icon.svg +3 -0
  28. package/src/components/GraphRightSidePanel/styles.ts +8 -0
  29. package/src/components/GraphTypeSelector/GraphTypeSelector.tsx +56 -0
  30. package/src/components/GraphTypeSelector/__tests__/GraphTypeSelector.test.tsx +109 -0
  31. package/src/components/GraphTypeSelector/styles.ts +17 -0
  32. package/src/components/HierarchyLayout/HierarchyLayout.ts +102 -0
  33. package/src/components/HierarchyLayout/__tests__/HierarchyLayout.spec.tsx +241 -0
  34. package/src/components/HierarchyLayout/__tests__/buildHierarchy.spec.ts +130 -0
  35. package/src/components/HierarchyLayout/__tests__/calculations.spec.ts +230 -0
  36. package/src/components/HierarchyLayout/buildHierarchy.ts +109 -0
  37. package/src/components/HierarchyLayout/calculations.ts +86 -0
  38. package/src/components/RightPanelEntityDetails/RightPanelEntityDetails.tsx +33 -0
  39. package/src/components/RightPanelEntityDetails/__tests__/RightPanelEntityDetails.test.tsx +39 -0
  40. package/src/components/RightPanelEntityDetails/styles.ts +12 -0
  41. package/src/components/RightPanelProfileBand/RightPanelProfileBand.tsx +33 -0
  42. package/src/components/RightPanelProfileBand/__tests__/RightPanelProfileBand.test.tsx +67 -0
  43. package/src/components/RightPanelProfileBand/styles.ts +8 -0
  44. package/src/components/RightPanelRelationship/RightPanelRelationship.tsx +25 -0
  45. package/src/components/RightPanelRelationship/__tests__/RightPanelRelationship.test.tsx +18 -0
  46. package/src/components/RightPanelRelationship/components/CollapsibleTable/CollapsibleTable.tsx +100 -0
  47. package/src/components/RightPanelRelationship/components/CollapsibleTable/TableHead.tsx +38 -0
  48. package/src/components/RightPanelRelationship/components/CollapsibleTable/__tests__/CollapsibleTable.test.tsx +169 -0
  49. package/src/components/RightPanelRelationship/components/CollapsibleTable/__tests__/TableHead.test.tsx +107 -0
  50. package/src/components/RightPanelRelationship/components/CollapsibleTable/styles.ts +38 -0
  51. package/src/components/RightPanelRelationship/components/CollapsibleTable/types.ts +20 -0
  52. package/src/components/RightPanelRelationship/components/DeleteRelationDialog/DeleteRelationDialog.tsx +34 -0
  53. package/src/components/RightPanelRelationship/components/DeleteRelationDialog/__tests__/DeleteRelationDialog.test.tsx +46 -0
  54. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/GraphAddRelationButton.tsx +43 -0
  55. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/GraphAddRelationDialog.tsx +121 -0
  56. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/__tests__/GraphAddRelationButton.test.tsx +80 -0
  57. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/__tests__/GraphAddRelationDialog.test.tsx +262 -0
  58. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/__tests__/mockdata.ts +75 -0
  59. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/styles.ts +25 -0
  60. package/src/components/RightPanelRelationship/components/GraphAddRelationDialog/useCreatableInOutRelationTypes.ts +13 -0
  61. package/src/components/RightPanelRelationship/components/RelationshipTable/RelationshipTable.tsx +126 -0
  62. package/src/components/RightPanelRelationship/components/RelationshipTable/__tests__/RelationshipTable.test.tsx +176 -0
  63. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/ControlsCellRenderer.tsx +59 -0
  64. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/DefaultCellRenderer.tsx +29 -0
  65. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/ExpandedRowRenderer.tsx +94 -0
  66. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/HeadCellRenderer.tsx +34 -0
  67. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/ProfileCellRenderer.tsx +41 -0
  68. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/ControlsCellRenderer.test.tsx +80 -0
  69. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/DefaultCellRenderer.test.tsx +47 -0
  70. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/ExpandedRowRenderer.test.tsx +166 -0
  71. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/HeadCellRenderer.test.tsx +23 -0
  72. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/__tests__/ProfileCellRenderer.test.tsx +47 -0
  73. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/components/DeleteRelationButton.tsx +32 -0
  74. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/components/__tests__/DeleteRelationButton.test.tsx +28 -0
  75. package/src/components/RightPanelRelationship/components/RelationshipTable/cell-renderers/styles.ts +113 -0
  76. package/src/components/RightPanelRelationship/components/RelationshipTable/styles.ts +36 -0
  77. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFilters.tsx +41 -0
  78. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFiltersDialog/RelationshipsFiltersDialog.tsx +91 -0
  79. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFiltersDialog/__tests__/RelationshipsFilterDialog.test.tsx +192 -0
  80. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsFiltersDialog/styles.ts +34 -0
  81. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsSearchTextField/RelationshipsSearchTextField.tsx +31 -0
  82. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsSearchTextField/__tests__/RelationshipsSearchTextField.test.tsx +43 -0
  83. package/src/components/RightPanelRelationship/components/RelationshipsFilters/RelationshipsSearchTextField/styles.ts +17 -0
  84. package/src/components/RightPanelRelationship/components/RelationshipsFilters/__tests__/RelationshipsFilters.test.tsx +76 -0
  85. package/src/components/RightPanelRelationship/components/RelationshipsFilters/styles.ts +19 -0
  86. package/src/components/RightPanelRelationship/styles.ts +20 -0
  87. package/src/components/SigmaCustomRenderers/SigmaCustomRenderersContainer.tsx +16 -0
  88. package/src/components/SigmaGraphContainer/SigmaGraphContainer.tsx +55 -0
  89. package/src/components/SigmaGraphContainer/__tests__/SigmaGraphContainer.test.tsx +25 -0
  90. package/src/components/SigmaGraphResizer/SigmaGraphResizer.tsx +13 -0
  91. package/src/components/SigmaGraphResizer/__tests__/SigmaGraphResizer.test.tsx +28 -0
  92. package/src/components/TreeLayout/TreeLayout.tsx +33 -0
  93. package/src/components/TreeLayout/__tests__/TreeLayout.test.tsx +42 -0
  94. package/src/components/TreeLayout/styles.ts +10 -0
  95. package/src/components/ZoomSlider/ZoomSlider.tsx +90 -0
  96. package/src/components/ZoomSlider/__tests__/ZoomSlider.test.tsx +84 -0
  97. package/src/components/ZoomSlider/styles.ts +57 -0
  98. package/src/constants/index.ts +1 -0
  99. package/src/contexts/GraphStateContext.tsx +19 -0
  100. package/src/contexts/SigmaCustomRenderersContext.ts +20 -0
  101. package/src/helpers/relationsHelpers.ts +9 -0
  102. package/src/hooks/__tests__/useGraphLayout.test.tsx +825 -0
  103. package/src/hooks/__tests__/useGraphLayoutSelector.test.tsx +19 -0
  104. package/src/hooks/__tests__/useSelfRelationLoopsRenderer.test.ts +198 -0
  105. package/src/hooks/__tests__/useSigmaCustomRenderers.test.ts +273 -0
  106. package/src/hooks/__tests__/useTooltipRenderer.test.ts +289 -0
  107. package/src/hooks/useGraphLayout.ts +308 -0
  108. package/src/hooks/useGraphLayoutSelector.ts +19 -0
  109. package/src/hooks/useGraphLoader.ts +279 -0
  110. package/src/hooks/useGraphRightSidePanelElements.tsx +36 -0
  111. package/src/hooks/useGraphState.ts +40 -0
  112. package/src/hooks/useGraphType.ts +32 -0
  113. package/src/hooks/useRelationshipTable.ts +212 -0
  114. package/src/hooks/useRelationshipTableFilters.ts +43 -0
  115. package/src/hooks/useSelectedEntity.ts +89 -0
  116. package/src/hooks/useSelfRelationLoopsRenderer.ts +52 -0
  117. package/src/hooks/useSigmaCustomRenderers.ts +112 -0
  118. package/src/hooks/useTooltipRenderer.ts +80 -0
  119. package/src/index.tsx +37 -0
  120. package/src/rendering/canvas/__tests__/hover.spec.ts +31 -0
  121. package/src/rendering/canvas/__tests__/label.spec.ts +64 -0
  122. package/src/rendering/canvas/__tests__/nodeBackground.spec.ts +99 -0
  123. package/src/rendering/canvas/__tests__/selfRelationLoop.spec.ts +88 -0
  124. package/src/rendering/canvas/__tests__/tooltip.spec.ts +33 -0
  125. package/src/rendering/canvas/hover.ts +13 -0
  126. package/src/rendering/canvas/label.ts +33 -0
  127. package/src/rendering/canvas/nodeBackground.ts +61 -0
  128. package/src/rendering/canvas/selfRelationLoop.ts +108 -0
  129. package/src/rendering/canvas/tooltip.ts +38 -0
  130. package/src/rendering/icons/collapseIcon.inline.svg.ts +6 -0
  131. package/src/rendering/icons/expandIcon.inline.svg.ts +5 -0
  132. package/src/rendering/icons/no_photo.inline.svg.ts +13 -0
  133. package/src/rendering/webgl/edge.arrowHead.ts +87 -0
  134. package/src/rendering/webgl/edge.clamped.ts +246 -0
  135. package/src/rendering/webgl/edge.reversedArrowHead.ts +14 -0
  136. package/src/rendering/webgl/helpers/__tests__/imageHelper.spec.ts +36 -0
  137. package/src/rendering/webgl/helpers/imageHelper.ts +13 -0
  138. package/src/rendering/webgl/image.ts +115 -0
  139. package/src/rendering/webgl/node.border.ts +78 -0
  140. package/src/rendering/webgl/node.buttons.ts +241 -0
  141. package/src/rendering/webgl/node.image.ts +169 -0
  142. package/src/rendering/webgl/shaders/edge.clamped.vert.glsl.ts +55 -0
  143. package/src/rendering/webgl/shaders/node.border.frag.glsl.ts +30 -0
  144. package/src/rendering/webgl/shaders/node.border.vert.glsl.ts +37 -0
  145. package/src/rendering/webgl/shaders/node.buttons.frag.glsl.ts +32 -0
  146. package/src/rendering/webgl/shaders/node.buttons.vert.glsl.ts +49 -0
  147. package/src/rendering/webgl/shaders/node.image.frag.glsl.ts +46 -0
  148. package/src/rendering/webgl/shaders/node.image.vert.glsl.ts +42 -0
  149. package/src/types/graphDataTypes.ts +143 -0
  150. package/src/types/sigmaCustomRenderersTypes.ts +13 -0
  151. package/src/utils/__tests__/graph.spec.ts +152 -0
  152. package/src/utils/__tests__/graphLayout.spec.ts +125 -0
  153. package/src/utils/__tests__/hopsData.spec.ts +456 -0
  154. package/src/utils/__tests__/processResponceToGraph.spec.ts +165 -0
  155. package/src/utils/graph.ts +83 -0
  156. package/src/utils/graphLayout.ts +70 -0
  157. package/src/utils/hopsData.ts +198 -0
  158. package/src/utils/processResponseToGraph.ts +32 -0
  159. package/tsconfig.json +4 -0
  160. package/webpack.config.js +10 -0
  161. package/bundle.js +0 -2
  162. package/bundle.js.LICENSE.txt +0 -54
  163. /package/{5271a9e7b6651c852e93.png → public/5271a9e7b6651c852e93.png} +0 -0
  164. /package/{main.css → public/main.css} +0 -0
@@ -0,0 +1,13 @@
1
+ import {Settings} from 'sigma/settings';
2
+ import {NodeDisplayData, PartialButFor} from 'sigma/types';
3
+ import {drawLabel} from './label';
4
+ import {drawNodeBackground} from './nodeBackground';
5
+
6
+ export const drawHover = (
7
+ context: CanvasRenderingContext2D,
8
+ data: PartialButFor<NodeDisplayData, 'x' | 'y' | 'size' | 'label'>,
9
+ settings: Settings
10
+ ): void => {
11
+ drawNodeBackground(context, data, settings, true);
12
+ drawLabel(context, data, settings, false);
13
+ };
@@ -0,0 +1,33 @@
1
+ /*
2
+ * This file copies sigma/rendering/canvas/label.ts with custom style
3
+ */
4
+ import {Settings} from 'sigma/settings';
5
+ import {NodeDisplayData, PartialButFor} from 'sigma/types';
6
+ import {drawNodeBackground} from './nodeBackground';
7
+
8
+ export const drawLabel = (
9
+ context: CanvasRenderingContext2D,
10
+ data: PartialButFor<NodeDisplayData, 'x' | 'y' | 'size' | 'label'>,
11
+ settings: Settings,
12
+ drawBackground = true
13
+ ): void => {
14
+ if (!data.label) return;
15
+
16
+ const size = settings.labelSize,
17
+ font = settings.labelFont,
18
+ weight = settings.labelWeight;
19
+
20
+ if (drawBackground) {
21
+ drawNodeBackground(context, data, settings, false);
22
+ }
23
+
24
+ context.shadowOffsetX = 0;
25
+ context.shadowOffsetY = 0;
26
+ context.shadowBlur = 0;
27
+
28
+ context.fillStyle = settings.labelColor?.attribute
29
+ ? data[settings.labelColor.attribute] || settings.labelColor.color || '#000'
30
+ : settings.labelColor.color;
31
+ context.font = `${weight} ${size}px ${font}`;
32
+ context.fillText(data.label, data.x + data.size + 11, data.y + size / 3);
33
+ };
@@ -0,0 +1,61 @@
1
+ /*
2
+ * This file part of sigma/rendering/canvas/hover.ts with custom style
3
+ */
4
+ import {Settings} from 'sigma/settings';
5
+ import {NodeDisplayData, PartialButFor} from 'sigma/types';
6
+
7
+ const PADDING = 2;
8
+
9
+ export const drawNodeBackground = (
10
+ context: CanvasRenderingContext2D,
11
+ data: PartialButFor<NodeDisplayData, 'x' | 'y' | 'size' | 'label'>,
12
+ settings: Settings,
13
+ drawNodeArc = true
14
+ ): void => {
15
+ context.fillStyle = '#FFF';
16
+ context.shadowOffsetX = 0;
17
+ context.shadowOffsetY = 2;
18
+ context.shadowBlur = 3;
19
+ context.shadowColor = 'rgba(0,0,0,0.2)';
20
+
21
+ if (typeof data.label === 'string') {
22
+ const size = settings.labelSize + 2;
23
+ const borderRadius = 2;
24
+
25
+ const textWidth = context.measureText(data.label).width,
26
+ boxWidth = Math.round(textWidth + 16),
27
+ boxHeight = Math.round(size + 2 * PADDING),
28
+ radius = Math.max(data.size, size / 2) + PADDING;
29
+
30
+ const top = data.y - boxHeight / 2;
31
+ const bottom = data.y + boxHeight / 2;
32
+ const left = data.x + (drawNodeArc ? 0 : radius);
33
+ const right = left + boxWidth + (drawNodeArc ? radius : 0);
34
+
35
+ context.beginPath();
36
+ context.moveTo(left, bottom - borderRadius);
37
+ context.quadraticCurveTo(left, bottom, left + borderRadius, bottom);
38
+ context.lineTo(right - borderRadius, bottom);
39
+ context.quadraticCurveTo(right, bottom, right, bottom - borderRadius);
40
+ context.lineTo(right, top + borderRadius);
41
+ context.quadraticCurveTo(right, top, right - borderRadius, top);
42
+ context.lineTo(left + borderRadius, top);
43
+ context.quadraticCurveTo(left, top, left, top + borderRadius);
44
+ context.closePath();
45
+ context.fill();
46
+
47
+ if (drawNodeArc) {
48
+ context.shadowOffsetX = -2;
49
+ context.shadowOffsetY = 0;
50
+ context.beginPath();
51
+ context.arc(data.x, data.y, radius, 0, Math.PI * 2);
52
+ context.closePath();
53
+ context.fill();
54
+ }
55
+ } else if (drawNodeArc) {
56
+ context.beginPath();
57
+ context.arc(data.x, data.y, data.size + PADDING, 0, Math.PI * 2);
58
+ context.closePath();
59
+ context.fill();
60
+ }
61
+ };
@@ -0,0 +1,108 @@
1
+ import {NodeDisplayData, PartialButFor} from 'sigma/types';
2
+ import {EdgeAttributes} from '../../types/graphDataTypes';
3
+
4
+ const ARROW_SCALE = 0.4;
5
+ const LOOP_SCALE = 0.6;
6
+ const ARROW_SIZE_RATIO_SCALE = 2.2;
7
+
8
+ const getSelfLoopControlPoints = (x: number, y: number, size: number, a = 0) => {
9
+ return {
10
+ x1: x - (size + a) * 7,
11
+ y1: y,
12
+ x2: x,
13
+ y2: y + (size + a) * 7
14
+ };
15
+ };
16
+
17
+ const getArrowPoints = (x: number, y: number, d: number, sX: number, sY: number, size: number, aSize: number) => {
18
+ const aX = x + ((sX - x) * (d - aSize - size)) / d;
19
+ const aY = y + ((sY - y) * (d - aSize - size)) / d;
20
+ const vX = ((sX - x) * aSize) / d;
21
+ const vY = ((sY - y) * aSize) / d;
22
+ return {aX, aY, vX, vY};
23
+ };
24
+
25
+ const getFirstArrowPoints = (
26
+ cp: ReturnType<typeof getSelfLoopControlPoints>,
27
+ sX: number,
28
+ sY: number,
29
+ size: number,
30
+ aSize: number
31
+ ) => {
32
+ const d = Math.sqrt(Math.pow(sX - cp.x1, 2) + Math.pow(sY - cp.y1, 2));
33
+ return getArrowPoints(cp.x2, cp.y2, d, sX, sY, size, aSize);
34
+ };
35
+
36
+ const getSecondArrowPoints = (
37
+ cp: ReturnType<typeof getSelfLoopControlPoints>,
38
+ sX: number,
39
+ sY: number,
40
+ size: number,
41
+ aSize: number
42
+ ) => {
43
+ const d = Math.sqrt(Math.pow(sX - cp.x1, 2) + Math.pow(sY - cp.y1, 2));
44
+ return getArrowPoints(cp.x1, cp.y1, d, sX, sY, size, aSize);
45
+ };
46
+
47
+ const drawArrow = (context: CanvasRenderingContext2D, aX: number, aY: number, vX: number, vY: number) => {
48
+ context.beginPath();
49
+ context.moveTo(aX + vX, aY + vY);
50
+ context.lineTo(aX + vY * ARROW_SCALE, aY - vX * ARROW_SCALE);
51
+ context.lineTo(aX - vY * ARROW_SCALE, aY + vX * ARROW_SCALE);
52
+ context.lineTo(aX + vX, aY + vY);
53
+ context.closePath();
54
+ context.fill();
55
+ };
56
+
57
+ const drawSelfRelationLoop = (
58
+ context: CanvasRenderingContext2D,
59
+ edgeData: EdgeAttributes,
60
+ sourceData: PartialButFor<NodeDisplayData, 'x' | 'y' | 'size'>
61
+ ): Path2D => {
62
+ const {size, color, arrowSizeRatio = 1} = edgeData;
63
+ const sX = sourceData.x;
64
+ const sY = sourceData.y;
65
+ const sSize = sourceData.size;
66
+ const scale = sSize * LOOP_SCALE;
67
+ const cp = getSelfLoopControlPoints(sX, sY, scale);
68
+
69
+ context.strokeStyle = color;
70
+ context.lineWidth = size;
71
+
72
+ const bezier = new Path2D();
73
+
74
+ if (edgeData.type === 'arrow' || edgeData.type === 'doubleArrow') {
75
+ context.fillStyle = color;
76
+ if (edgeData.type === 'doubleArrow') {
77
+ const firstArrowPoints = getFirstArrowPoints(
78
+ cp,
79
+ sX,
80
+ sY,
81
+ sSize,
82
+ size * arrowSizeRatio * ARROW_SIZE_RATIO_SCALE
83
+ );
84
+ drawArrow(context, firstArrowPoints.aX, firstArrowPoints.aY, firstArrowPoints.vX, firstArrowPoints.vY);
85
+ bezier.moveTo(firstArrowPoints.aX, firstArrowPoints.aY);
86
+ } else {
87
+ bezier.moveTo(sX, sY);
88
+ }
89
+ const secondArrowPoints = getSecondArrowPoints(
90
+ cp,
91
+ sX,
92
+ sY,
93
+ sSize,
94
+ size * arrowSizeRatio * ARROW_SIZE_RATIO_SCALE
95
+ );
96
+ bezier.bezierCurveTo(cp.x2, cp.y2, cp.x1, cp.y1, secondArrowPoints.aX, secondArrowPoints.aY);
97
+ context.stroke(bezier);
98
+ drawArrow(context, secondArrowPoints.aX, secondArrowPoints.aY, secondArrowPoints.vX, secondArrowPoints.vY);
99
+ } else {
100
+ bezier.moveTo(sX, sY);
101
+ bezier.bezierCurveTo(cp.x1, cp.y1, cp.x2, cp.y2, sX, sY);
102
+ context.stroke(bezier);
103
+ }
104
+
105
+ return bezier;
106
+ };
107
+
108
+ export {drawSelfRelationLoop};
@@ -0,0 +1,38 @@
1
+ const drawRoundedRect = (
2
+ context: CanvasRenderingContext2D,
3
+ x: number,
4
+ y: number,
5
+ width: number,
6
+ height: number,
7
+ radius: number
8
+ ) => {
9
+ context.beginPath();
10
+ context.moveTo(x, y + radius);
11
+ context.arcTo(x, y + height, x + radius, y + height, radius);
12
+ context.arcTo(x + width, y + height, x + width, y + height - radius, radius);
13
+ context.arcTo(x + width, y, x + width - radius, y, radius);
14
+ context.arcTo(x, y, x, y + radius, radius);
15
+ context.fill();
16
+ };
17
+
18
+ const drawTooltip = (context: CanvasRenderingContext2D, centerX: number, centerY: number, text: string) => {
19
+ context.font = 'normal 10px Roboto';
20
+ context.textAlign = 'center';
21
+ context.textBaseline = 'middle';
22
+
23
+ const xPadding = 8;
24
+ const width = context.measureText(text).width + xPadding * 2;
25
+ const height = 24;
26
+ const radius = 4;
27
+
28
+ const x = centerX - width / 2;
29
+ const y = centerY - height / 2;
30
+
31
+ context.fillStyle = 'rgba(0, 0, 0, 0.54)';
32
+ drawRoundedRect(context, x, y, width, height, radius);
33
+
34
+ context.fillStyle = '#fff';
35
+ context.fillText(text, x + width / 2, y + height / 2);
36
+ };
37
+
38
+ export {drawTooltip};
@@ -0,0 +1,6 @@
1
+ export const COLLAPSE_ICON = `<svg width="32" height="32" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="8" cy="8" r="8" fill="white"/>
3
+ <circle cx="8" cy="8" r="7.5" stroke="black" stroke-opacity="0.541176"/>
4
+ <path d="M4 7.20004H12V8.80004H4V7.20004Z" fill="black" fill-opacity="0.541176"/>
5
+ </svg>
6
+ `;
@@ -0,0 +1,5 @@
1
+ export const EXPAND_ICON = `<svg width="32" height="32" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="8" cy="8" r="8" fill="white"/>
3
+ <circle cx="8" cy="8" r="7.5" stroke="black" stroke-opacity="0.541176"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M8.80013 7.20003V4H7.20013L7.20013 7.20003H4V8.80003H7.20013L7.20013 12H8.80013V8.80003H12V7.20003H8.80013Z" fill="black" fill-opacity="0.541176"/>
5
+ </svg>`;
@@ -0,0 +1,13 @@
1
+ export const DEFAULT_PROFILE_IMAGE = `
2
+ <svg width="400px" height="400px" viewBox="0 0 400 400" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>Group</title>
4
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <g id="Group" fill-rule="nonzero">
6
+ <rect id="Rectangle" fill="#DFE5E9" x="0" y="0" width="400" height="400"></rect>
7
+ <path d="M0,387.023257 L0,399.918908 L400,399.918908 L400,386.023594 C366.631,377.336524 321.866,364.269931 315.979,359.161654 C308.985,353.083704 270.481,310.508063 270.481,310.508063 L270.481,286.186267 C270.481,286.186267 284.478,266.204006 284.478,261.854473 C284.478,257.515936 285.353,246.219746 291.481,241.011503 C297.61,235.792263 311.607,211.471466 312.481,206.253226 C313.355,201.043983 319.484,188.009379 312.481,185.400259 C305.478,182.801135 307.236,173.244359 308.984,168.026119 C310.733,162.817875 319.484,139.355788 322.981,133.277838 C326.488,127.199888 312.481,108.956041 312.481,108.956041 C312.481,108.956041 294.978,80.2857109 245.975,53.3547939 C196.971,26.4138803 168.967,42.9283105 168.967,42.9283105 L161.964,60.3024507 C161.964,60.3024507 138.341,64.6409874 123.46,77.6765909 C108.589,90.7121943 99.837,106.346921 98.963,115.903698 C98.088,125.460475 103.334,159.339048 105.966,164.557289 C108.589,169.765532 112.96,185.400259 112.96,185.400259 C112.96,185.400259 108.589,183.670842 105.966,188.879085 C103.334,194.097325 112.085,218.419122 112.96,220.159535 C113.834,221.897949 114.718,238.403382 119.963,237.532676 C125.218,236.663969 130.463,251.42799 130.463,251.42799 C130.463,251.42799 143.596,271.41125 144.47,275.759783 C145.344,280.09832 147.967,307.039233 147.967,307.039233 L126.967,331.36103 L102.46,355.682827 C102.459,355.682827 34.042,375.886013 0,387.023257 Z" id="Path" fill="#B3BCC4"></path>
8
+ <path d="M0,387.023257 L0,399.918908 L400,399.918908 L400,386.023594 C366.631,377.336524 321.866,364.269931 315.979,359.161654 C308.985,353.083704 270.481,310.508063 270.481,310.508063 L270.481,286.186267 C270.481,286.186267 284.478,266.204006 284.478,261.854473 C284.478,257.515936 285.353,246.219746 291.481,241.011503 C297.61,235.792263 311.607,211.471466 312.481,206.253226 C313.355,201.043983 319.484,188.009379 312.481,185.400259 C305.478,182.801135 307.236,173.244359 308.984,168.026119 C310.733,162.817875 319.484,139.355788 322.981,133.277838 C326.488,127.199888 312.481,108.956041 312.481,108.956041 C312.481,108.956041 294.978,80.2857109 245.975,53.3547939 C196.971,26.4138803 168.967,42.9283105 168.967,42.9283105 L161.964,60.3024507 C161.964,60.3024507 138.341,64.6409874 123.46,77.6765909 C108.589,90.7121943 99.837,106.346921 98.963,115.903698 C98.088,125.460475 103.334,159.339048 105.966,164.557289 C108.589,169.765532 112.96,185.400259 112.96,185.400259 C112.96,185.400259 108.589,183.670842 105.966,188.879085 C103.334,194.097325 112.085,218.419122 112.96,220.159535 C113.834,221.897949 114.718,238.403382 119.963,237.532676 C125.218,236.663969 130.463,251.42799 130.463,251.42799 C130.463,251.42799 143.596,271.41125 144.47,275.759783 C145.344,280.09832 147.967,307.039233 147.967,307.039233 L126.967,331.36103 L102.46,355.682827 C102.459,355.682827 34.042,375.886013 0,387.023257 Z" id="Path" fill="#B3BCC4"></path>
9
+ <path d="M5.68434189e-14,387.023257 L5.68434189e-14,399.918908 L400,399.918908 L400,386.023594 C366.631,377.336524 321.866,364.269931 315.979,359.161654 C308.985,353.083704 270.481,310.508063 270.481,310.508063 L270.481,286.186267 C270.481,286.186267 284.478,266.204006 284.478,261.854473 C284.478,257.515936 285.353,246.219746 291.481,241.011503 C297.61,235.792263 311.607,211.471466 312.481,206.253226 C313.355,201.043983 319.484,188.009379 312.481,185.400259 C305.478,182.801135 307.236,173.244359 308.984,168.026119 C310.733,162.817875 319.484,139.355788 322.981,133.277838 C326.488,127.199888 312.481,108.956041 312.481,108.956041 C312.481,108.956041 294.978,80.2857109 245.975,53.3547939 C196.971,26.4138803 168.967,42.9283105 168.967,42.9283105 L161.964,60.3024507 C161.964,60.3024507 138.341,64.6409874 123.46,77.6765909 C108.589,90.7121943 99.837,106.346921 98.963,115.903698 C98.088,125.460475 103.334,159.339048 105.966,164.557289 C108.589,169.765532 112.96,185.400259 112.96,185.400259 C112.96,185.400259 108.589,183.670842 105.966,188.879085 C103.334,194.097325 112.085,218.419122 112.96,220.159535 C113.834,221.897949 114.718,238.403382 119.963,237.532676 C125.218,236.663969 130.463,251.42799 130.463,251.42799 C130.463,251.42799 143.596,271.41125 144.47,275.759783 C145.344,280.09832 147.967,307.039233 147.967,307.039233 L126.967,331.36103 L102.46,355.682827 C102.459,355.682827 34.042,375.886013 5.68434189e-14,387.023257 Z" id="Path" fill="#B3BCC4"></path>
10
+ </g>
11
+ </g>
12
+ </svg>
13
+ `;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * This class extends src/rendering/webgl/programs/edge.arrowHead.ts for arrowSizeRatio support
3
+ */
4
+ import SigmaEdgeArrowHeadProgram from 'sigma/rendering/webgl/programs/edge.arrowHead';
5
+ import {floatColor} from 'sigma/utils';
6
+ import {EdgeAttributes, NodeAttributes} from '../../types/graphDataTypes';
7
+
8
+ const POINTS = 3,
9
+ ATTRIBUTES = 9,
10
+ STRIDE = POINTS * ATTRIBUTES;
11
+
12
+ export default class EdgeArrowHeadProgram extends SigmaEdgeArrowHeadProgram {
13
+ process(
14
+ sourceData: NodeAttributes,
15
+ targetData: NodeAttributes,
16
+ data: EdgeAttributes,
17
+ hidden: boolean,
18
+ offset: number
19
+ ): void {
20
+ if (hidden) {
21
+ for (let i = offset * STRIDE, l = i + STRIDE; i < l; i++) this.array[i] = 0;
22
+
23
+ return;
24
+ }
25
+ // Our changes - added arrowSizeRatio support
26
+ const arrowSizeRatio = data.arrowSizeRatio || 1;
27
+ const thickness = data.size * arrowSizeRatio || 1,
28
+ radius = targetData.size || 1,
29
+ x1 = sourceData.x,
30
+ y1 = sourceData.y,
31
+ x2 = targetData.x,
32
+ y2 = targetData.y,
33
+ color = floatColor(data.color);
34
+
35
+ // Computing normals
36
+ const dx = x2 - x1,
37
+ dy = y2 - y1;
38
+
39
+ let len = dx * dx + dy * dy,
40
+ n1 = 0,
41
+ n2 = 0;
42
+
43
+ if (len) {
44
+ len = 1 / Math.sqrt(len);
45
+
46
+ n1 = -dy * len * thickness;
47
+ n2 = dx * len * thickness;
48
+ }
49
+
50
+ let i = POINTS * ATTRIBUTES * offset;
51
+
52
+ const array = this.array;
53
+
54
+ // First point
55
+ array[i++] = x2;
56
+ array[i++] = y2;
57
+ array[i++] = -n1;
58
+ array[i++] = -n2;
59
+ array[i++] = radius;
60
+ array[i++] = color;
61
+ array[i++] = 1;
62
+ array[i++] = 0;
63
+ array[i++] = 0;
64
+
65
+ // Second point
66
+ array[i++] = x2;
67
+ array[i++] = y2;
68
+ array[i++] = -n1;
69
+ array[i++] = -n2;
70
+ array[i++] = radius;
71
+ array[i++] = color;
72
+ array[i++] = 0;
73
+ array[i++] = 1;
74
+ array[i++] = 0;
75
+
76
+ // Third point
77
+ array[i++] = x2;
78
+ array[i++] = y2;
79
+ array[i++] = -n1;
80
+ array[i++] = -n2;
81
+ array[i++] = radius;
82
+ array[i++] = color;
83
+ array[i++] = 0;
84
+ array[i++] = 0;
85
+ array[i] = 1;
86
+ }
87
+ }
@@ -0,0 +1,246 @@
1
+ /**
2
+ * This class copies src/rendering/webgl/programs/edge.clamped.ts, but with a some difference:
3
+ * implemented arrowSizeRatio edge attribute, forwarded it to shaders as a_arrowSizeRatio
4
+ * implemented 'doubleArrow' edge type support
5
+ */
6
+
7
+ import {floatColor, canUse32BitsIndices} from 'sigma/utils';
8
+ import {AbstractEdgeProgram} from 'sigma/rendering/webgl/programs/common/edge';
9
+ import fragmentShaderSource from 'sigma/rendering/webgl/shaders/edge.frag.glsl';
10
+ import {RenderParams} from 'sigma/rendering/webgl/programs/common/program';
11
+
12
+ import {vertexShaderSource} from './shaders/edge.clamped.vert.glsl';
13
+ import {EdgeAttributes, NodeAttributes} from '../../types/graphDataTypes';
14
+
15
+ const POINTS = 4,
16
+ ATTRIBUTES = 7,
17
+ STRIDE = POINTS * ATTRIBUTES;
18
+
19
+ export default class EdgeClampedProgram extends AbstractEdgeProgram {
20
+ IndicesArray: Uint32ArrayConstructor | Uint16ArrayConstructor;
21
+ indicesArray: Uint32Array | Uint16Array;
22
+ indicesBuffer: WebGLBuffer;
23
+ indicesType: GLenum;
24
+ positionLocation: GLint;
25
+ colorLocation: GLint;
26
+ normalLocation: GLint;
27
+ radiusLocation: GLint;
28
+ arrowSizeRatioLocation: GLint; // our change
29
+ matrixLocation: WebGLUniformLocation;
30
+ sqrtZoomRatioLocation: WebGLUniformLocation;
31
+ correctionRatioLocation: WebGLUniformLocation;
32
+ canUse32BitsIndices: boolean;
33
+
34
+ constructor(gl: WebGLRenderingContext) {
35
+ super(gl, vertexShaderSource, fragmentShaderSource, POINTS, ATTRIBUTES);
36
+
37
+ // Initializing indices buffer
38
+ const indicesBuffer = gl.createBuffer();
39
+ if (indicesBuffer === null) throw new Error('EdgeClampedProgram: error while getting resolutionLocation');
40
+ this.indicesBuffer = indicesBuffer;
41
+
42
+ // Locations:
43
+ this.positionLocation = gl.getAttribLocation(this.program, 'a_position');
44
+ this.colorLocation = gl.getAttribLocation(this.program, 'a_color');
45
+ this.normalLocation = gl.getAttribLocation(this.program, 'a_normal');
46
+ this.radiusLocation = gl.getAttribLocation(this.program, 'a_radius');
47
+ this.arrowSizeRatioLocation = gl.getAttribLocation(this.program, 'a_arrowSizeRatio'); // our change
48
+
49
+ // Uniform locations
50
+ const matrixLocation = gl.getUniformLocation(this.program, 'u_matrix');
51
+ if (matrixLocation === null) throw new Error('EdgeClampedProgram: error while getting matrixLocation');
52
+ this.matrixLocation = matrixLocation;
53
+
54
+ const sqrtZoomRatioLocation = gl.getUniformLocation(this.program, 'u_sqrtZoomRatio');
55
+ if (sqrtZoomRatioLocation === null)
56
+ throw new Error('EdgeClampedProgram: error while getting cameraRatioLocation');
57
+ this.sqrtZoomRatioLocation = sqrtZoomRatioLocation;
58
+
59
+ const correctionRatioLocation = gl.getUniformLocation(this.program, 'u_correctionRatio');
60
+ if (correctionRatioLocation === null)
61
+ throw new Error('EdgeClampedProgram: error while getting viewportRatioLocation');
62
+ this.correctionRatioLocation = correctionRatioLocation;
63
+
64
+ // Enabling the OES_element_index_uint extension
65
+ // NOTE: on older GPUs, this means that really large graphs won't
66
+ // have all their edges rendered. But it seems that the
67
+ // `OES_element_index_uint` is quite everywhere so we'll handle
68
+ // the potential issue if it really arises.
69
+ // NOTE: when using webgl2, the extension is enabled by default
70
+ this.canUse32BitsIndices = canUse32BitsIndices(gl);
71
+ this.IndicesArray = this.canUse32BitsIndices ? Uint32Array : Uint16Array;
72
+ this.indicesArray = new this.IndicesArray();
73
+ this.indicesType = this.canUse32BitsIndices ? gl.UNSIGNED_INT : gl.UNSIGNED_SHORT;
74
+
75
+ this.bind();
76
+ }
77
+
78
+ bind(): void {
79
+ const gl = this.gl;
80
+
81
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer);
82
+
83
+ // Bindings
84
+ gl.enableVertexAttribArray(this.positionLocation);
85
+ gl.enableVertexAttribArray(this.normalLocation);
86
+ gl.enableVertexAttribArray(this.colorLocation);
87
+ gl.enableVertexAttribArray(this.radiusLocation);
88
+ gl.enableVertexAttribArray(this.arrowSizeRatioLocation); // our change
89
+
90
+ gl.vertexAttribPointer(
91
+ this.positionLocation,
92
+ 2,
93
+ gl.FLOAT,
94
+ false,
95
+ ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT,
96
+ 0
97
+ );
98
+ gl.vertexAttribPointer(this.normalLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
99
+ gl.vertexAttribPointer(
100
+ this.colorLocation,
101
+ 4,
102
+ gl.UNSIGNED_BYTE,
103
+ true,
104
+ ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT,
105
+ 16
106
+ );
107
+ gl.vertexAttribPointer(
108
+ this.radiusLocation,
109
+ 1,
110
+ gl.FLOAT,
111
+ false,
112
+ ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT,
113
+ 20
114
+ );
115
+ // our change
116
+ gl.vertexAttribPointer(
117
+ this.arrowSizeRatioLocation,
118
+ 1,
119
+ gl.FLOAT,
120
+ false,
121
+ ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT,
122
+ 24
123
+ );
124
+ }
125
+
126
+ process(
127
+ sourceData: NodeAttributes,
128
+ targetData: NodeAttributes,
129
+ data: EdgeAttributes,
130
+ hidden: boolean,
131
+ offset: number
132
+ ): void {
133
+ if (hidden) {
134
+ for (let i = offset * STRIDE, l = i + STRIDE; i < l; i++) this.array[i] = 0;
135
+ return;
136
+ }
137
+ const arrowSizeRatio = data.arrowSizeRatio || 1; // our change
138
+
139
+ const thickness = data.size || 1,
140
+ x1 = sourceData.x,
141
+ y1 = sourceData.y,
142
+ x2 = targetData.x,
143
+ y2 = targetData.y,
144
+ //our change - added sourceRadius
145
+ sourceRadius = data.type === 'doubleArrow' ? sourceData.size || 1 : 0,
146
+ targetRadius = targetData.size || 1,
147
+ color = floatColor(data.color);
148
+
149
+ // Computing normals
150
+ const dx = x2 - x1,
151
+ dy = y2 - y1;
152
+
153
+ let len = dx * dx + dy * dy,
154
+ n1 = 0,
155
+ n2 = 0;
156
+
157
+ if (len) {
158
+ len = 1 / Math.sqrt(len);
159
+
160
+ n1 = -dy * len * thickness;
161
+ n2 = dx * len * thickness;
162
+ }
163
+
164
+ let i = POINTS * ATTRIBUTES * offset;
165
+
166
+ const array = this.array;
167
+
168
+ // First point
169
+ array[i++] = x1;
170
+ array[i++] = y1;
171
+ array[i++] = n1;
172
+ array[i++] = n2;
173
+ array[i++] = color;
174
+ array[i++] = -sourceRadius;
175
+ array[i++] = arrowSizeRatio;
176
+
177
+ // First point flipped
178
+ array[i++] = x1;
179
+ array[i++] = y1;
180
+ array[i++] = -n1;
181
+ array[i++] = -n2;
182
+ array[i++] = color;
183
+ array[i++] = sourceRadius;
184
+ array[i++] = arrowSizeRatio;
185
+
186
+ // Second point
187
+ array[i++] = x2;
188
+ array[i++] = y2;
189
+ array[i++] = n1;
190
+ array[i++] = n2;
191
+ array[i++] = color;
192
+ array[i++] = targetRadius;
193
+ array[i++] = arrowSizeRatio;
194
+
195
+ // Second point flipped
196
+ array[i++] = x2;
197
+ array[i++] = y2;
198
+ array[i++] = -n1;
199
+ array[i++] = -n2;
200
+ array[i++] = color;
201
+ array[i++] = -targetRadius;
202
+ array[i] = arrowSizeRatio;
203
+ }
204
+
205
+ computeIndices(): void {
206
+ const l = this.array.length / ATTRIBUTES;
207
+ const size = l + l / 2;
208
+ const indices = new this.IndicesArray(size);
209
+
210
+ for (let i = 0, c = 0; i < l; i += 4) {
211
+ indices[c++] = i;
212
+ indices[c++] = i + 1;
213
+ indices[c++] = i + 2;
214
+ indices[c++] = i + 2;
215
+ indices[c++] = i + 1;
216
+ indices[c++] = i + 3;
217
+ }
218
+
219
+ this.indicesArray = indices;
220
+ }
221
+
222
+ bufferData(): void {
223
+ super.bufferData();
224
+
225
+ // Indices data
226
+ const gl = this.gl;
227
+ gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indicesArray, gl.STATIC_DRAW);
228
+ }
229
+
230
+ render(params: RenderParams): void {
231
+ if (this.hasNothingToRender()) return;
232
+
233
+ const gl = this.gl;
234
+
235
+ const program = this.program;
236
+ gl.useProgram(program);
237
+
238
+ // Binding uniforms
239
+ gl.uniformMatrix3fv(this.matrixLocation, false, params.matrix);
240
+ gl.uniform1f(this.sqrtZoomRatioLocation, Math.sqrt(params.ratio));
241
+ gl.uniform1f(this.correctionRatioLocation, params.correctionRatio);
242
+
243
+ // Drawing:
244
+ gl.drawElements(gl.TRIANGLES, this.indicesArray.length, this.indicesType, 0);
245
+ }
246
+ }
@@ -0,0 +1,14 @@
1
+ import {EdgeAttributes, NodeAttributes} from '../../types/graphDataTypes';
2
+ import EdgeArrowHeadProgram from './edge.arrowHead';
3
+
4
+ export default class EdgeReversedArrowHeadProgram extends EdgeArrowHeadProgram {
5
+ process(
6
+ sourceData: NodeAttributes,
7
+ targetData: NodeAttributes,
8
+ data: EdgeAttributes,
9
+ hidden: boolean,
10
+ offset: number
11
+ ): void {
12
+ super.process(targetData, sourceData, data, hidden, offset);
13
+ }
14
+ }
@@ -0,0 +1,36 @@
1
+ import {clearCrossOriginForCORSIfNotSameOrigin} from '../imageHelper';
2
+
3
+ describe('clearCrossOriginForCORSIfNotSameOrigin tests', () => {
4
+ const savedLocation = window.location;
5
+
6
+ beforeEach(() => {
7
+ delete window.location;
8
+ window.location = {
9
+ origin: 'http://test'
10
+ } as Location;
11
+ });
12
+
13
+ afterEach(() => {
14
+ window.location = savedLocation;
15
+ });
16
+
17
+ it('should clear crossOrigin if origin is not the same', () => {
18
+ const img = new Image();
19
+ const url = 'http://imagePath/images/123.png';
20
+ img.crossOrigin = 'testValue';
21
+
22
+ clearCrossOriginForCORSIfNotSameOrigin(img, url);
23
+
24
+ expect(img.crossOrigin).toBe('');
25
+ });
26
+
27
+ it('should not clear crossOrigin if origin is the same', () => {
28
+ const img = new Image();
29
+ const url = 'http://test/images/123.png';
30
+ img.crossOrigin = 'testValue';
31
+
32
+ clearCrossOriginForCORSIfNotSameOrigin(img, url);
33
+
34
+ expect(img.crossOrigin).toBe('testValue');
35
+ });
36
+ });