Skip to content

Commit

Permalink
#1228 Zoom not working on Firefox (#1229)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlyn authored Oct 29, 2022
1 parent d943e2c commit 52ca919
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,17 @@ export default class SVGCanvasRenderer {
// Returns the current mouse position based on the D3 SVG selection object
// passed in.
getMousePos(d3Event, svgSel) {
const mousePos = d3.pointer(d3Event, svgSel.node());
return { x: mousePos[0], y: mousePos[1] };
// The d3Event must have either a sourceEvent or be an actual event, which
// can be indicated by the existence of a pageX attribute. This test is only
// necessary on Firefox and then only when the action (such as zoom)
// calling this function is itself called programmatically - for example,
// when the user clicks one of the zoom buttons on the toolbar. It's not
// clear why d3.pointer cannot handle all events like it can on Chrome.
if (d3Event.sourceEvent || d3Event.pageX) {
const mousePos = d3.pointer(d3Event, svgSel.node());
return { x: mousePos[0], y: mousePos[1] };
}
return { x: 0, y: 0 };
}

// Convert coordinates from the page (based on the page top left corner) to
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ setup_git_branch
checkout_branch ${MAIN}

cd ./canvas_modules/common-canvas
npm version minor
npm version patch
NPM_VERSION=`node -p "require('./package.json').version"`
echo "Updated main build $NPM_VERSION"
commit_changes ${MAIN} "Update Elyra Canvas to version ${NPM_VERSION} [skip ci]"
Expand Down

0 comments on commit 52ca919

Please sign in to comment.