Skip to content

eles.boundingBox() options : includeMainLabels, includeSourceLabels, includeTargetLabels #2502

Closed
@maxkfranz

Description

@maxkfranz

Issue type

Feature request

Description of new feature

Add the following options to eles.boundingBox() (and eles.renderedBoundingBox()):

  • includeMainLabels : A boolean, whether to include the main label in the returned bounds.
  • includeSourceLabels : A boolean, whether to include the source label of an edge in the returned bounds.
  • includeTargetLabels : A boolean, whether to include the target label of an edge in the returned bounds.

Behaviour to maintain compatibility with existing apps:

  • The existing includeLabels option acts as an override when false, excluding all the labels in the bounding box result.
  • Each flag is true by default.

Motivation for new feature

See #1679. If you can query an element for only the bounding box of a particular label, then it's easy to determine whether an event.position is within the bounds of the label.

By using this feature, a programmer can add features like direct manipulation of labels (e.g. drag on a label to move it). It also allows for features like click-to-type. Those sorts of features would make great extensions.

This proposed feature enables these use-cases with minimal added complexity of the Cytoscape.js API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions