Fix large canvas rendering (at closest zoom levels), with WebEngine #3711
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While running some tests with the most recent AppImage Daily Build, I loaded a project file and noticed that the ruler completely disappeared at 1-second zoom — it wasn't merely cut off, the whole thing was gone.
Turned out, the project had a duration of 644 seconds, which at 1-second zoom made the total timeline width
64450
pixels, well in excess of the 32Kpixel max supported width for HTML<canvas>
elements. When I zoomed out to the 3-second level (21000-and-change pixels wide), the ruler reappeared.It appears that the WebEngine layout engine, in contrast to WebKit, will completely fail to render a canvas element that exceeds the max supported dimensions. With WebKit, the canvas was merely cut off at the maximum width, but WebEngine is clearly more fragile.
This PR adds a
canvasMaxWidth()
constraint function to the$scope
incontroller.js
, which takes a single numerical argument (desired_width
) and executes one statement:return Math.min(32767, desired_width);
All code for computing canvas width in both the HTML and the JavaScript now wraps all of those computations incanvasMaxWidth()
to ensure that none of the canvas elements exceed their maximum allowable dimensions.The audio-waveform rendering appears a bit "off" in this code, placed oddly and sticking out onto the border of the Clip area slightly. But that's identical to how it renders with the current
develop
branch code before this PR, so #NOTMYFAULT.Might fix some open Issues, not sure. I haven't checked in a few days.