(boundingRectOpt)
| 1713 | } |
| 1714 | |
| 1715 | function buildBoundingRects(boundingRectOpt) { |
| 1716 | ensureBoundingRectsFacilities(); |
| 1717 | boundingRectOpt = isObject(boundingRectOpt) ? boundingRectOpt : {}; |
| 1718 | |
| 1719 | boundingRectsContainer.style.display = 'block'; |
| 1720 | _bRectGroup.removeAll(); |
| 1721 | |
| 1722 | var strokeColor = boundingRectOpt.color || 'rgba(0,0,255,0.5)'; |
| 1723 | var silent = boundingRectOpt.silent != null ? boundingRectOpt.silent : false; |
| 1724 | |
| 1725 | boundingRectsContainer.style.pointerEvent = silent ? 'none' : 'auto'; |
| 1726 | |
| 1727 | var roots = chart.getZr().storage.getRoots(); |
| 1728 | for (var rootIdx = 0; rootIdx < roots.length; rootIdx++) { |
| 1729 | travelGroupAndBuildRects(roots[rootIdx], _bRectGroup); |
| 1730 | } |
| 1731 | |
| 1732 | // Follow chart update and resize. |
| 1733 | chart.on('finished', updateBoundingRects); |
| 1734 | |
| 1735 | return; |
| 1736 | |
| 1737 | function travelGroupAndBuildRects(el, visualRectGroupParent) { |
| 1738 | if (el.childrenRef) { // group or text |
| 1739 | var visualRectGroup = createVisualRectGroup(el, visualRectGroupParent) |
| 1740 | var children = el.childrenRef(); |
| 1741 | for (var idx = 0; idx < children.length; idx++) { |
| 1742 | var child = children[idx]; |
| 1743 | travelGroupAndBuildRects(child, visualRectGroup); |
| 1744 | } |
| 1745 | } |
| 1746 | // Both display ZRText and TSpan bounding rect for debuging. |
| 1747 | if (!el.isGroup) { |
| 1748 | createVisualRectForEl(el, visualRectGroupParent); |
| 1749 | } |
| 1750 | |
| 1751 | function createVisualRectForEl(el, visualRectGroup) { |
| 1752 | createRectForDisplayable(el, visualRectGroup); |
| 1753 | var textContent = el.getTextContent(); |
| 1754 | var textGuildLine = el.getTextGuideLine(); |
| 1755 | var textConfig = el.textConfig; |
| 1756 | if (textContent || textGuildLine) { |
| 1757 | var isLocal = textConfig && textConfig.local; |
| 1758 | var targetVisualGroup = isLocal ? visualRectGroup : _bRectGroup; |
| 1759 | textContent && createRectForDisplayable(textContent, targetVisualGroup, true); |
| 1760 | textGuildLine && createRectForDisplayable(textGuildLine, targetVisualGroup, true); |
| 1761 | } |
| 1762 | } |
| 1763 | |
| 1764 | function createVisualRectGroup(fromEl, visualRectGroupParent) { |
| 1765 | var visualRectGroup = new echarts.graphic.Group(); |
| 1766 | copyTransformAttrs(visualRectGroup, fromEl); |
| 1767 | visualRectGroupParent.add(visualRectGroup); |
| 1768 | return visualRectGroup; |
| 1769 | } |
| 1770 | |
| 1771 | function createRectForDisplayable(el, visualRectGroup, useInnerTransformable) { |
| 1772 | var elRawRect = el.getBoundingRect(); |
no test coverage detected
searching dependent graphs…