Skip to content

fix(tree): apply selected line style to edges. close #18214#21681

Open
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-18214-tree-select-line-style
Open

fix(tree): apply selected line style to edges. close #18214#21681
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-18214-tree-select-line-style

Conversation

@rahul37wallst-sudo

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Applies configured select.lineStyle to tree node edges when tree nodes are selected.

Fixed issues

Details

Before: What was the problem?

Tree node symbols could enter the select state correctly, so select.itemStyle worked on the selected node.

However, the tree edge/branch is rendered as a sibling element of the node symbol group, not as a child of it. The generic selection update only marks the node symbol group as selected, so the edge never entered the select state even though its select.lineStyle state style was already configured.

After: How does it behave after the fixing?

Tree edges now mirror the selection state of their corresponding tree nodes.

The fix updates tree edge selection in TreeView by applying enterSelect / leaveSelect to each node edge based on seriesModel.isSelected(dataIndex). It runs after render and during select, unselect, and toggleSelect actions, so both initial selected state and later selection changes are handled.

A regression unit test was added to verify that:

  • select.lineStyle.color is stored on the tree edge select state;
  • selecting a tree node marks its edge as selected;
  • single-select selection clears the previously selected edge and selects the new edge.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

test/ut/spec/series/tree.test.ts

Validation run:

npx jest --config test/ut/jest.config.cjs --coverage=false --runInBand --runTestsByPath test/ut/spec/series/tree.test.ts
npm run checktype
npm run lint
npx eslint test/ut/spec/series/tree.test.ts
git --no-pager diff --check

Merging options

  • Please squash the commits into a single one when merging.

Other information

N.A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant