Skip to content

[Bug]: Broken restrict translate of selection #3009

@frnora

Description

@frnora

Current versus expected behaviour

Hi,

Upon updating from 4.0.1 to 4.1.1 I couldn't wrap my head around why the embedded cells are rendered all over the place and get unmounted/mounted upon drag. It looks like there is an issue in the adjustSelection method.

Code of ui.Selection's adjustSelection:

// restrict to area
const selectedElements = this.collection.filter(cell => cell.isElement());
const elementsBBox = graph.getBBox(selectedElements);
[dx, dy] = this.respectRestrictTranslate(dx, dy, elementsBBox);

graph.getBBox returns the bbox of ALL the elements. I assume this should be graph.getCellsBBox(selectedElements)

Thanks for fixing this!

Steps to reproduce

  1. Restrict translate to some bbox
  2. Select some cells (not all, a subset)
  3. Try to translate them

Version

4.1.1

What browsers are you seeing the problem on?

No response

What operating system are you seeing the problem on?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions