Skip to content

Commit

Permalink
refactor: simplify overlay management in JS bridge code (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouffard authored Sep 15, 2023
1 parent cfd60d9 commit 6a1a401
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions inst/htmlwidgets/bpmnVisualizationR.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ HTMLWidgets.widget({
const overlayConfig = {...rest};

if(enableDefaultOverlayStyle && !(overlayConfig.style && overlayConfig.position)) {
const elementsByIds = bpmnVisualization.bpmnElementsRegistry.getElementsByIds(elementId);
if (elementsByIds.length) {
const isShape = elementsByIds[0].bpmnSemantic.isShape;
const elements = bpmnVisualization.bpmnElementsRegistry.getModelElementsByIds(elementId);
if (elements.length) {
const isShape = elements[0].isShape;
overlayConfig.style ??= buildDefaultOverlayStyle(isShape);
overlayConfig.position ??= buildDefaultOverlayPosition(isShape);
}
Expand All @@ -80,7 +80,7 @@ HTMLWidgets.widget({
},

// Make the bpmnVisualization object available as a property on the widget instance we're returning from factory().
// This is generally a good idea for extensibility--it helps users of this widget interact directly with bpmnVisualization, if needed.
// This is generally a good idea for extensibility: it helps users of this widget to interact directly with bpmnVisualization, if required.
s: bpmnVisualization
};
}
Expand Down

0 comments on commit 6a1a401

Please sign in to comment.