Skip to content

feat(layers): Graph and Paper embedding layers implementation #2908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

Geliogabalus
Copy link
Contributor

@Geliogabalus Geliogabalus commented Mar 18, 2025

Description

Adds new functionality to the Graph and Paper which allows to use layers for the embedding. The behaviour controlled by useLayersForEmbedding graph option.

Motivation and Context

Make possible to use layers for embedding.

@Geliogabalus Geliogabalus marked this pull request as draft March 18, 2025 16:17
@@ -70,6 +71,17 @@ export const Graph = Model.extend({

opt = opt || {};

this.enableCellLayers = opt.enableCellLayers || false;

this.defaultLayerName = 'cells';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should move this outside as class property

@@ -70,6 +71,17 @@ export const Graph = Model.extend({

opt = opt || {};

this.enableCellLayers = opt.enableCellLayers || false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not seem to be used anywhere

this._unregisterLayer(layerView);
this.addLayer(layerName, layerView, { insertBefore });
if (!layer) {
throw new Error('dia.Paper: The layer view is not an instance of dia.LayerView.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the error is not exactly what the check does

},

// @deprecated
getLastCell: function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should accept layerName now and not be deprecated

@@ -117,7 +117,7 @@ export const HighlighterView = mvc.View.extend({
vGroup = V('g').addClass('highlight-transform').append(el);
}
this.transformGroup = vGroup;
paper.getLayerView(layerName).insertSortedNode(vGroup.node, options.z);
paper.getLayer(layerName).insertSortedNode(vGroup.node, options.z);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paper.geLayer() should stay paper.getLayerView() (same analogy to graph.findCellsInArea() and paper.findCellViewsInArea()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants