diff --git a/canvas_modules/common-canvas/src/common-canvas/svg-canvas-renderer.js b/canvas_modules/common-canvas/src/common-canvas/svg-canvas-renderer.js index 0d8f72bfc3..31aa941784 100644 --- a/canvas_modules/common-canvas/src/common-canvas/svg-canvas-renderer.js +++ b/canvas_modules/common-canvas/src/common-canvas/svg-canvas-renderer.js @@ -6411,27 +6411,12 @@ export default class SVGCanvasRenderer { handlesGrp .append(this.canvasLayout.linkStartHandleObject) .attr("class", (d) => "d3-link-handle-start") - // Use mouse down instead of click because it gets called before drag start. - .on("mousedown", (d3Event, d) => { - this.logger.log("Link start handle - mouse down"); - if (!this.config.enableDragWithoutSelect) { - this.selectObjectD3Event(d3Event, d, "link"); - } - this.logger.log("Link end handle - finished mouse down"); - }); + .call(this.attachStartHandleListeners.bind(this)); handlesGrp .append(this.canvasLayout.linkEndHandleObject) .attr("class", (d) => "d3-link-handle-end") - // Use mouse down instead of click because it gets called before drag start. - .on("mousedown", (d3Event, d) => { - this.logger.log("Link end handle - mouse down"); - if (!this.config.enableDragWithoutSelect) { - this.selectObjectD3Event(d3Event, d, "link"); - } - this.logger.log("Link end handle - finished mouse down"); - }); - + .call(this.attachEndHandleListeners.bind(this)); } // Updates the start and end link handles for the handle groups passed in. @@ -6494,6 +6479,32 @@ export default class SVGCanvasRenderer { } } + // Attaches any required event listeners to the start handles of the links. + attachStartHandleListeners(startHandles) { + startHandles + // Use mouse down instead of click because it gets called before drag start. + .on("mousedown", (d3Event, d) => { + this.logger.log("Link start handle - mouse down"); + if (!this.config.enableDragWithoutSelect) { + this.selectObjectD3Event(d3Event, d, "link"); + } + this.logger.log("Link end handle - finished mouse down"); + }); + } + + // Attaches any required event listeners to the end handles of the links. + attachEndHandleListeners(endHandles) { + endHandles + // Use mouse down instead of click because it gets called before drag start. + .on("mousedown", (d3Event, d) => { + this.logger.log("Link end handle - mouse down"); + if (!this.config.enableDragWithoutSelect) { + this.selectObjectD3Event(d3Event, d, "link"); + } + this.logger.log("Link end handle - finished mouse down"); + }); + } + // Sets the custom inline styles on the link object passed in. setLinkLineStyles(linkObj, link, type) { const style = CanvasUtils.getObjectStyle(link, "line", type);