Heavy SVG images in custom libraries are re-rasterized on every scroll/zoom frame (shape panel and canvas)
@alderg is already working on this.
Since Nov 17, 2026.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend, performance
Research direction
Reproduce with the linked drawio-mikrotik library files and read the reference userscript drawio-svg-cache, especially how it swaps the href of <image> elements above a 4 KB threshold. Trace where the shape panel and canvas create and move <image> elements during scroll and zoom, then define the cache boundary so only editor rendering changes while the model, file, export and print keep the original SVG. Done means heavy SVG shapes render through a cached bitmap that refreshes when zoom settles, with the measured raster cost reduced and vector fallback at high zoom.
Written by the indexing model from the issue text.
Description
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Is your feature request related to a problem? Please describe.
With a custom shape library of detailed SVG images (network device front panels, 25–115 KB of SVG each, hundreds of paths and gradients per image), draw.io becomes noticeably laggy:
- scrolling the shape panel with the library open;
- zooming the canvas with a few dozen of these shapes;
- scrolling the canvas vertically (horizontal scrolling stays smooth).
On a desktop PC with a 210 Hz display, horizontal scrolling runs at ~200 fps, while zooming drops to roughly 20–60 fps. draw.io Desktop 32.6.10 on Windows, also reproducible on app.diagrams.net 32.7.3.
To reproduce:
- Download the library files from https://github.com/HugoFiermein/drawio-mikrotik/tree/dev/library and load them with File > Open Library (45 device images, 8 files).
- Scroll the shape panel, or drop ~30 shapes on the canvas and zoom in and out.
As far as I can tell, the cause is that each image stays a live vector <image> inside the panel/canvas SVG, so the browser rasterizes all of its paths and gradients again on every frame where the image moves to a new tile or changes scale. Reducing file size does not help much: after minifying the library by ~45 % the raster cost changed by 1–8 %.
Describe the solution you'd like
Show such images through a bitmap rendered once at the displayed size, and re-render it when the zoom settles. The model, file, export and print keep the original SVG; only the editor view changes. A built-in option like this would make large SVG libraries usable.
Describe alternatives you've considered
I made a proof of concept as a userscript (and a patcher for draw.io Desktop): https://github.com/HugoFiermein/drawio-svg-cache
It only swaps the href of <image> elements above a size threshold (4 KB) and falls back to the vector when zoomed in far. It works, but it has to be installed separately and re-applied after every Desktop update.
Additional context
Measured with the proof of concept on draw.io 32.6.10 in headless Chrome, 50 device images, time spent by the raster threads:
| Scenario | Without | With cache |
|---|---|---|
| Scrolling the shape panel, 240 frames | 2870–3230 ms | 145–160 ms |
| Zooming the canvas with 30 shapes, 60 steps | 2320–2610 ms | 1035–1210 ms |
I know pull requests are not accepted, so this is only a suggestion with a working reference.
- Dominant language
- JavaScript
- Stars
- 9.4k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jgraph/drawio
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Requesting a VPAT for app.diagrams.netPossibly taken @alderg claimed this 24 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Import TablesOpenenhancement possible-duplicate
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 82/100
Leonxlnx/taste-skill#216 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
all-contributors/cli#690 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area: ui Bug Payload OSS
Difficulty 1/5 Under an hour Newbie friendliness 88/100
payloadcms/payload#19839 ·
Maintainers usually reply within 1 day