antvis / G6

♾ A Graph Visualization Framework in JavaScript.
https://g6.antv.antgroup.com/
MIT License
11.03k stars 1.31k forks source link

[V5.05] drag positon error #5993

Open bartoval opened 2 months ago

bartoval commented 2 months ago

Describe the bug / 问题描述

from this version I started having problems that I didn't have in the previous version. When I drag a node or combo it seems that the positions and the calculation of the delta. Here a video to clarify the issue

https://github.com/antvis/G6/assets/79913332/05e67ee8-9803-4aff-9fc3-1b5f33b9f87c

moreover it seems 'drag-canvas' and 'zoom-canvas' don't work anymore

Reproduction link / 重现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Linux

Browser / 浏览器

Chrome

Additional context / 补充说明

No response

Aarebecca commented 2 months ago

It looks like you used combo and customized it, I'm not sure if you used the built-in rectangle combo or implemented it yourself, if you can provide a reproduction example, we will find out the cause of the problem soon.

bartoval commented 2 months ago

Thanks for the response. Yes I am using a custom combo but it is just a extesion of the basic rect

class SkCombo extends RectCombo { render(attrs: Required<RectComboStyleProps>) { super.render({ ...attrs, ...COMBO_CONFIG }); } }

and COMBO_CONFIG is:

export const COMBO_CONFIG: ComboOptions = {
  style: {
    fillOpacity: 1,
    lineWidth: 4,
    fill: COMBO__COLOR_DEFAULT,
    stroke: COMBO_BORDER_COLOR_DEFAULT,
    radius: 10,
    cursor: 'grab',
    labelFill: COMBO_COLOR_DEFAULT_LABEL,
    labelFontFamily: 'RedHatText',
    labelPadding: [2, 5],
    labelFontSize: LABEL_FONT_SIZE + 2,
    labelPosition: 'bottom',
    labelBackground: true,
    labelOffsetY: 5,
    labelBackgroundRadius: 2,
    labelBackgroundFill: COMBO_COLOR_DEFAULT_LABEL_BG,
    labelBackgroundStroke: COMBO_BORDER_COLOR_DEFAULT
  },

  state: {
    hover: {
      stroke: COMBO_BORDER_COLOR_HOVER
    }
  }
};

then my behaviours

 behaviors: [
    'drag-canvas',
    'zoom-canvas',
    'drag-element',
  ....
  combo: { ...COMBO_CONFIG }
};