You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/graph/node/node.js
+24-43Lines changed: 24 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -261,9 +261,9 @@ node.addNewElements = function (enteringData) {
261
261
// Disable right click context menu on value nodes
262
262
gNewNodeElements.filter(function(d){
263
263
returnd.type===node.NodeTypes.VALUE;
264
-
}).on("contextmenu",function(){
264
+
}).on("contextmenu",function(event){
265
265
// Disable context menu on
266
-
d3.event.preventDefault();
266
+
event.preventDefault();
267
267
});
268
268
269
269
varnodeDefs=gNewNodeElements.append("defs");
@@ -344,8 +344,8 @@ node.addForegroundElements = function (gNewNodeElements) {
344
344
.attr("class","ppt-arrow")
345
345
.attr("d","m -44.905361,-23 6.742,-6.742 c 0.81,-0.809 0.81,-2.135 0,-2.944 l -0.737,-0.737 c -0.81,-0.811 -2.135,-0.811 -2.945,0 l -8.835,8.835 c -0.435,0.434 -0.628,1.017 -0.597,1.589 -0.031,0.571 0.162,1.154 0.597,1.588 l 8.835,8.834 c 0.81,0.811 2.135,0.811 2.945,0 l 0.737,-0.737 c 0.81,-0.808 0.81,-2.134 0,-2.943 l -6.742,-6.743 z");
346
346
347
-
glArrow.on("click",function(clickedNode){
348
-
d3.event.stopPropagation();// To avoid click event on svg element in background
347
+
glArrow.on("click",function(event,clickedNode){
348
+
event.stopPropagation();// To avoid click event on svg element in background
349
349
350
350
// On left arrow click page number is decreased and node expanded to display the new page
351
351
if(clickedNode.page>1){
@@ -369,8 +369,8 @@ node.addForegroundElements = function (gNewNodeElements) {
369
369
.attr("class","ppt-arrow")
370
370
.attr("d","m 51.027875,-24.5875 -8.835,-8.835 c -0.811,-0.811 -2.137,-0.811 -2.945,0 l -0.738,0.737 c -0.81,0.81 -0.81,2.136 0,2.944 l 6.742,6.742 -6.742,6.742 c -0.81,0.81 -0.81,2.136 0,2.943 l 0.737,0.737 c 0.81,0.811 2.136,0.811 2.945,0 l 8.835,-8.836 c 0.435,-0.434 0.628,-1.017 0.597,-1.588 0.032,-0.569 -0.161,-1.152 -0.596,-1.586 z");
371
371
372
-
grArrow.on("click",function(clickedNode){
373
-
d3.event.stopPropagation();// To avoid click event on svg element in background
372
+
grArrow.on("click",function(event,clickedNode){
373
+
event.stopPropagation();// To avoid click event on svg element in background
exports[`render Should works with 1 word as text Should render correctly 1`] =`"<div><g><rectfill=\\"mocked_color_value\\"class=\\"mocked_css_class_value\\"x=\\"-53\\"y=\\"-50\\"rx=\\"5\\"ry=\\"5\\"width=\\"106\\"height=\\"100\\"transform=\\"translate(0,0)scale(0.5543250876981161)\\"></rect><textclass=\\"fitted-textmocked_css_class_value\\"style=\\"text-anchor:middle;font:10pxsans-serif\\"transform=\\"translate(0,0)scale(0.5543250876981161)\\"><tspanx=\\"0\\"y=\\"3.6000000000000005\\">mockedTextValue</tspan></text></g></div>"`;
3
+
exports[`render Should works with 1 word as text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="106"height="100"transform="translate(0,0) scale(5.2057920629535355)"></rect><textclass="fitted-text mocked_css_class_value"style="text-anchor: middle; font: 10px sans-serif"transform="translate(0,0) scale(5.2057920629535355)"><tspanx="0"y="3.6000000000000005">mockedTextValue</tspan></text></g></div>"`;
exports[`render Should works with empty text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="6"height="0"transform="translate(0,0) scale(1)"></rect><textclass="fitted-text mocked_css_class_value"style="text-anchor: middle; font: 10px sans-serif"transform="translate(0,0) scale(1)"></text></g></div>"`;
exports[`render Should works with integer as text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="106"height="100"transform="translate(0,0) scale(8.304547985373997)"></rect><textclass="fitted-text mocked_css_class_value"style="text-anchor: middle; font: 10px sans-serif"transform="translate(0,0) scale(8.304547985373997)"><tspanx="0"y="3.6000000000000005">0</tspan></text></g></div>"`;
exports[`render Should works with multiple words as text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="106"height="100"transform="translate(0,0) scale(4.805693313322127)"></rect><textclass="fitted-text mocked_css_class_value"style="text-anchor: middle; font: 10px sans-serif"transform="translate(0,0) scale(4.805693313322127)"><tspanx="0"y="3.6000000000000005">mocked textvalue</tspan></text></g></div>"`;
exports[`render Should works with multiple words on same span Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="106"height="100"transform="translate(0,0) scale(3.6637165272365584)"></rect><textclass="fitted-text mocked_css_class_value"style="text-anchor: middle; font: 10px sans-serif"transform="translate(0,0) scale(3.6637165272365584)"><tspanx="0"y="-2.3999999999999995">mockedtext a</tspan><tspanx="0"y="9.600000000000001">value</tspan></text></g></div>"`;
exports[`render Should works with undefined text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="6"height="0"transform="translate(0,0) scale(1)"></rect><textclass="fitted-text mocked_css_class_value"style="text-anchor: middle; font: 10px sans-serif"transform="translate(0,0) scale(1)"></text></g></div>"`;
Copy file name to clipboardExpand all lines: test/graph/node/__snapshots__/textRender.test.js.snap
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
exports[`Test TEXT_Y default value to center text vertically 1`] =`8`;
4
4
5
-
exports[`render Should works with empty text Should render correctly 1`] =`"<div><g><rectfill=\\"mocked_color_value\\"class=\\"mocked_css_class_value\\"x=\\"-53\\"y=\\"-50\\"rx=\\"5\\"ry=\\"5\\"width=\\"6\\"height=\\"0\\"></rect><textx=\\"0\\"y=\\"8\\"text-anchor=\\"middle\\"class=\\"mocked_css_class_value2\\"></text></g></div>"`;
5
+
exports[`render Should works with empty text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="6"height="0"></rect><textx="0"y="8"text-anchor="middle"class="mocked_css_class_value2"></text></g></div>"`;
exports[`render Should works with integer text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="6"height="0"></rect><textx="0"y="8"text-anchor="middle"class="mocked_css_class_value2">0</text></g></div>"`;
8
8
9
9
exports[`render Should works with normal simple text MouseOver should remove correctly the parent clip path 1`] =`"url(#node-viewmocked_id_clip_path_value)"`;
10
10
@@ -14,6 +14,6 @@ exports[`render Should works with normal simple text Mouseout after the mouseove
14
14
15
15
exports[`render Should works with normal simple text Mouseout after the mouseover should reAdd correctly the parent clip path 2`] =`"url(#node-viewmocked_id_clip_path_value)"`;
exports[`render Should works with normal simple text Should render correctly 1`] =`"<div><gclip-path="url(#node-viewmocked_id_clip_path_value)"><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="106"height="100"></rect><textx="0"y="8"text-anchor="middle"class="mocked_css_class_value2">mocked text value</text></g></div>"`;
exports[`render Should works with undefined text Should render correctly 1`] =`"<div><g><rectfill="mocked_color_value"class="mocked_css_class_value"x="-53"y="-50"rx="5"ry="5"width="6"height="0"></rect><textx="0"y="8"text-anchor="middle"class="mocked_css_class_value2"></text></g></div>"`;
0 commit comments