Skip to content

Commit

Permalink
Test rect & rect.node found before getting bounding client rect (Issue:
Browse files Browse the repository at this point in the history
  • Loading branch information
toxophilist committed Aug 27, 2020
1 parent 233635f commit 3bc9c6b
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,25 @@ class DynamicRoutingGatewayView extends OkitDesignerArtefactView {
let svg = super.draw();
// Get Inner Rect to attach Connectors
let rect = svg.select("rect[id='" + safeId(this.id) + "']");
let boundingClientRect = rect.node().getBoundingClientRect();
// Add Connector Data
svg.attr("data-connector-start-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-start-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-end-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-end-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-id", this.id)
.attr("dragable", true)
.selectAll("*")
.attr("data-connector-start-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-start-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-end-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-end-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-id", this.id)
.attr("dragable", true);
// Draw Connectors
// this.drawConnectors();
if (rect && rect.node()) {
let boundingClientRect = rect.node().getBoundingClientRect();
// Add Connector Data
svg.attr("data-connector-start-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-start-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-end-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-end-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-id", this.id)
.attr("dragable", true)
.selectAll("*")
.attr("data-connector-start-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-start-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-end-y", boundingClientRect.y + boundingClientRect.height / 2)
.attr("data-connector-end-x", boundingClientRect.x + (boundingClientRect.width))
.attr("data-connector-id", this.id)
.attr("dragable", true);
// Draw Connectors
// this.drawConnectors();
}
console.groupEnd();
return svg;
}
Expand Down

0 comments on commit 3bc9c6b

Please sign in to comment.