natsuokawai opened a new pull request, #21390: URL: https://github.com/apache/echarts/pull/21390
<!-- Please fill in the following information to help us review your PR more efficiently. --> ## Brief Information This pull request is in the type of: - [x] bug fixing - [ ] new feature - [ ] others ### What does this PR do? <!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. --> Fixes an issue where click events were not triggered on matrix component cells. ### Fixed issues <!-- - #xxxx: ... --> - #21389 ## Details ### Before: What was the problem? <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. --> Even when `matrix.body.silent` was set to `false` (and the cell was made hit-testable, e.g., by setting `itemStyle.color` to `'transparent'`), click events on matrix cells were not being emitted by the ECharts instance. This was because the underlying graphic elements (rects and texts) created in `MatrixView` lacked the necessary `eventData` (ECData) to identify them as part of the matrix component. <!-- ADD SCREENSHOT HERE IF APPLICABLE. --> ### After: How does it behave after the fixing? <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. --> Click events are now correctly triggered when clicking on matrix cells. The event parameters include `componentType: 'matrix'`, `componentIndex`, and the cell's `name`. This is achieved by: 1. Importing `getECData` in `src/component/matrix/MatrixView.ts`. 2. Attaching `eventData` to the cell's rect and text elements during creation in `createMatrixCell`. <!-- ADD SCREENSHOT HERE IF APPLICABLE. --> https://github.com/user-attachments/assets/9ea217d5-acf2-42dd-8baf-0fb51e8259b7 ## Document Info One of the following should be checked. - [x] 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. <!-- PLEASE CHECK IT AGAINST: <https://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributors> --> ### ZRender Changes - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx). ### Related test cases or examples to use the new APIs Added a new test case in `test/ut/spec/component/matrix/event.test.ts` to verify the fix. ### Merging options - [ ] Please squash the commits into a single one when merging. ### Other information -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
