G6 icon indicating copy to clipboard operation
G6 copied to clipboard

feat: fitItems function

Open Blakko opened this issue 1 year ago • 2 comments

Checklist
  • [x] npm test passes
  • [x] tests and/or benchmarks are included
  • [x] commit message follows commit guidelines
Description of change

This PR implements the fitItems function. This allows to fit a subset of the graph, eg: fit only the selected items. This is useful with big graphs, where you want to have a closer look at a bunch of nodes.

In this example I'm using the fitItems function on the selected nodes via a keyboard shortcut:

animate false

https://user-images.githubusercontent.com/2861371/182404337-01167ecc-acfc-4ec2-98ce-c9af4da3b1e7.mp4

animate true

https://user-images.githubusercontent.com/2861371/182404386-77fbaccb-3fdb-4167-9bc6-ff2735257def.mp4

Blakko avatar Aug 04 '22 14:08 Blakko

Hi @Blakko , thanks for your PR! I have commented with some suggestions, please check them out to see if they are reasonable.

Yanyan-Wang avatar Aug 05 '22 07:08 Yanyan-Wang

My bad, I totally missed the focusItem function :) I'll apply the changes you suggested and update this PR asap!

Blakko avatar Aug 05 '22 11:08 Blakko