MCPcopy
hub / github.com/tdewolff/minify / removeNode

Function removeNode

_benchmarks/sample_echarts.js:52407–52479  ·  view source on GitHub ↗
(data, dataIndex, symbolEl, group, seriesModel)

Source from the content-addressed store, hash-verified

52405 }
52406
52407 function removeNode(data, dataIndex, symbolEl, group, seriesModel) {
52408 var node = data.tree.getNodeByDataIndex(dataIndex);
52409 var virtualRoot = data.tree.root;
52410 var source = node.parentNode === virtualRoot ? node : node.parentNode || node; // let edgeShape = seriesScope.edgeShape;
52411
52412 var sourceLayout;
52413
52414 while (sourceLayout = source.getLayout(), sourceLayout == null) {
52415 source = source.parentNode === virtualRoot ? source : source.parentNode || source;
52416 } // Use same duration and easing with update to have more consistent animation.
52417
52418
52419 var removeAnimationOpt = {
52420 duration: seriesModel.get('animationDurationUpdate'),
52421 easing: seriesModel.get('animationEasingUpdate')
52422 };
52423 removeElement(symbolEl, {
52424 x: sourceLayout.x + 1,
52425 y: sourceLayout.y + 1
52426 }, seriesModel, {
52427 cb: function () {
52428 group.remove(symbolEl);
52429 data.setItemGraphicEl(dataIndex, null);
52430 },
52431 removeOpt: removeAnimationOpt
52432 });
52433 symbolEl.fadeOut(null, {
52434 fadeLabel: true,
52435 animation: removeAnimationOpt
52436 });
52437 var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);
52438 var sourceEdge = sourceSymbolEl.__edge; // 1. when expand the sub tree, delete the children node should delete the edge of
52439 // the source at the same time. because the polyline edge shape is only owned by the source.
52440 // 2.when the node is the only children of the source, delete the node should delete the edge of
52441 // the source at the same time. the same reason as above.
52442
52443 var edge = symbolEl.__edge || (source.isExpand === false || source.children.length === 1 ? sourceEdge : undefined);
52444 var edgeShape = seriesModel.get('edgeShape');
52445 var layoutOpt = seriesModel.get('layout');
52446 var orient = seriesModel.get('orient');
52447 var curvature = seriesModel.get(['lineStyle', 'curveness']);
52448
52449 if (edge) {
52450 if (edgeShape === 'curve') {
52451 removeElement(edge, {
52452 shape: getEdgeShape(layoutOpt, orient, curvature, sourceLayout, sourceLayout),
52453 style: {
52454 opacity: 0
52455 }
52456 }, seriesModel, {
52457 cb: function () {
52458 group.remove(edge);
52459 },
52460 removeOpt: removeAnimationOpt
52461 });
52462 } else if (edgeShape === 'polyline' && seriesModel.get('layout') === 'orthogonal') {
52463 removeElement(edge, {
52464 shape: {

Callers 2

sample_echarts.jsFile · 0.85
doRenderNodeFunction · 0.85

Calls 2

removeElementFunction · 0.85
getEdgeShapeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…