MCPcopy Index your code
hub / github.com/apache/echarts / initShowBoundingRects

Function initShowBoundingRects

test/lib/testHelper.js:1650–1803  ·  view source on GitHub ↗

* @param {EChartsInstance} chart * @param {Parameter ['boundingRect']} opt.boundingRect

(chart, echarts, opt, boundingRectsContainer)

Source from the content-addressed store, hash-verified

1648 * @param {Parameter<testHelper.create, 2>['boundingRect']} opt.boundingRect
1649 */
1650 function initShowBoundingRects(chart, echarts, opt, boundingRectsContainer) {
1651 assert(chart.__testHelper);
1652
1653 var _bRectZr;
1654 var _bRectGroup;
1655 // @type Parameter<testHelper.create, 2>['boundingRect']
1656 var _currBoundingRectOpt = false;
1657
1658 chart.__testHelper.updateBoundingRects
1659 = chart.__testHelper.updateBoundingRect
1660 = chart.__testHelper.boundingRect
1661 = chart.__testHelper.boundingRects
1662 = updateBoundingRects;
1663
1664 updateBoundingRects(opt.boundingRect);
1665
1666 return;
1667
1668 function updateBoundingRects(opt) {
1669 if (arguments.length > 0) {
1670 _currBoundingRectOpt = opt;
1671 } // If no opt, keep the last one.
1672
1673 _currBoundingRectOpt
1674 ? buildBoundingRects(_currBoundingRectOpt)
1675 : disableBoundingRects();
1676 }
1677
1678 function ensureBoundingRectsFacilities() {
1679 // zr requires size non-zero.
1680 boundingRectsContainer.style.width = chart.getWidth() + 'px';
1681 boundingRectsContainer.style.height = chart.getHeight() + 'px';
1682
1683 if (_bRectZr) {
1684 _bRectZr.resize();
1685 return;
1686 }
1687
1688 _bRectGroup = new echarts.graphic.Group();
1689 _bRectGroup.__testHelperBoundingRectsRoot = true;
1690 _bRectGroup.on('click', function (event) {
1691 var target = event.target;
1692 if (!target || !target.__testHelperBoundingRectTarget) {
1693 return;
1694 }
1695 var wrapper = {
1696 boundingRect: target,
1697 rawElement: target.__testHelperBoundingRectTarget
1698 };
1699 console.log('boundingRect:', wrapper.boundingRect);
1700 console.log('rawElement:', wrapper.rawElement);
1701 window.$0 = wrapper;
1702 });
1703 _bRectZr = echarts.zrender.init(boundingRectsContainer);
1704 _bRectZr.add(_bRectGroup);
1705 }
1706
1707 function disableBoundingRects() {

Callers 1

testHelper.jsFile · 0.85

Calls 2

updateBoundingRectsFunction · 0.85
assertFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…