FlowFuse / flow-renderer

Apache License 2.0
5 stars 0 forks source link

Scrollbars not updated when zoomed in/out #30

Closed Steve-Mcl closed 4 months ago

Steve-Mcl commented 4 months ago

Current Behavior

When zooming scroll bars remain the same.

Expected Behavior

When zooming in, scroll bars should be reduced (more to scoll). When zooming out, scroll bars should be increased (less to scroll)

Steps To Reproduce

Zoom out to max, scrolling reveals whitespace.

Environment

Steve-Mcl commented 4 months ago

For later reference, this fix is to replace updateScale with below.:

    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) {
            mainSvgGroup.setAttribute('_scale_original', scale)
        }
    }