Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

饼图手机端选中样式不切换 #3512

Closed
cinob opened this issue Jul 9, 2021 · 5 comments
Closed

饼图手机端选中样式不切换 #3512

cinob opened this issue Jul 9, 2021 · 5 comments
Assignees

Comments

@cinob
Copy link

cinob commented Jul 9, 2021

image
如图官网demo,先点击事例1,再点击事例2 , 选中的样式还在事例1上

@hustcc
Copy link
Member

hustcc commented Oct 8, 2021

你使用的地址可以发一下吗?感觉不是官方网站啊~

@cinob
Copy link
Author

cinob commented Oct 8, 2021

https://g2.antv.vision/zh/examples/pie/basic#labelline 切到移动端

@hustcc hustcc self-assigned this Oct 9, 2021
@visiky
Copy link
Member

visiky commented Oct 17, 2021

参考:antvis/G2Plot#2904
原因:element-active 交互的触发时机为 element:mouseenter 以及 element:mouseleave. 在移动端没有 mouse 事件,所以需要复写修改触发时机

chart.interaction('element-active', {
  start: [{ trigger: 'element:click', action: 'element-active:active' },],
  end: [{
    trigger: 'element:click', isEnable: (context) => {
      const activeElement = context.event?.gEvent?.target?.get('element');
      const elements = context.view.geometries[0].elements;
      console.info('elements', elements.map(e => e.getStates()))
      elements.forEach(element => {
        if (element !== activeElement) {
          element.setState('active', false);
        }

      });
    }, action: 'element-active:reset'
  }],
});

@hustcc
Copy link
Member

hustcc commented Oct 21, 2021

@visiky 来 PR 吧~

@visiky
Copy link
Member

visiky commented Oct 21, 2021

@visiky 来 PR 吧~

PR demo?

@hustcc hustcc closed this as completed Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants