Skip to content

Commit

Permalink
Merge pull request #31 from FlowFuse/30-scrollbars-not-updated-when-z…
Browse files Browse the repository at this point in the history
…oomed-inout

Fix scrollbars not updated when zoomed inout
  • Loading branch information
joepavitt committed May 16, 2024
2 parents ab2beee + 898ab1c commit 5ba9a50
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,15 @@ const FlowRenderer = (function () {
function getScale(svg) {
return parseFloat(svg.getAttribute('_scale_current') || 1)
}
function updateScale(svg, scale, setAsDefault = false) {
svg.setAttribute('transform', `scale(${scale})`)
svg.style.width = `${8000 * scale}px`
svg.style.height = `${8000 * scale}px`
svg.setAttribute('_scale_current', scale)

function updateScale(mainSvgGroup, scale, setAsDefault = false) {
mainSvgGroup.setAttribute('transform', `scale(${scale})`)
const svg = mainSvgGroup.ownerSVGElement
svg.style.width = `${8000 * scale}px` // cause scrollbars to size correctly
svg.style.height = `${8000 * scale}px` // cause scrollbars to size correctly
mainSvgGroup.setAttribute('_scale_current', scale)
if (setAsDefault) {
svg.setAttribute('_scale_original', scale)
mainSvgGroup.setAttribute('_scale_original', scale)
}
}

Expand Down
2 changes: 1 addition & 1 deletion index.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flowfuse/flow-renderer",
"version": "0.3.0",
"version": "0.3.1",
"description": "Node-RED flow renderer",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5ba9a50

Please sign in to comment.