KLineChart icon indicating copy to clipboard operation
KLineChart copied to clipboard

[Feature] a unclick callback on shape (overlay)

Open obxyann opened this issue 2 years ago • 1 comments

Feature Description

a callback on shape about it lost its editable status...

To Do

When clicks on a drawn shape, it will draw some filled circles on it so we can edit the coordinates and the shape will also call onClick() callback. I use it (onClick) to indicate 'pick a drawn shape' and I will pop a toolbox to change the color, size.... of the shape or delete it :)

But when clicking on the chart area (clicks no shapes) , last clicked shape will lost the click status. I can't find any hooks about it. I need to close my toolbox. For now I am trying to use a timer to pull the click.id value inside ShapeStore.

    function checkToCloseEditBox () {
      const shapeEventOperate = chart._chartPane.chartStore().shapeStore().eventOperate()
      if (!shapeEventOperate.click.id) {
        console.log('no shape picked')
        // close edit box    
      }
    }

It will be better we have a callback on shape about it lost its editable status...

obxyann avatar Aug 16 '22 07:08 obxyann

Agree. onSelect and onDeselect would be absolutely awesome.

olablt avatar Aug 16 '22 08:08 olablt

V9 alpha has been released and supports this feature. You can try it.

liihuu avatar Jan 09 '23 18:01 liihuu