Heavy SVG images in custom libraries are re-rasterized on every scroll/zoom frame (shape panel and canvas)
@alderg ci sta già lavorando.
Dal 17/11/2026.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- frontend, performance
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
- 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.
- Lingua principale
- JavaScript
- Stelle
- 9.4k
- Fork
- 1.4k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jgraph/drawio
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Requesting a VPAT for app.diagrams.netForse già presa @alderg l’ha presa 24 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
Import TablesApertaenhancement possible-duplicate
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di jgraph/drawio
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 82/100
Leonxlnx/taste-skill#216 ·
I maintainer di solito rispondono entro 1 giorno
-
Docs: 11 broken linksAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
all-contributors/cli#690 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
area: ui Bug Payload OSS
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
payloadcms/payload#19839 ·
I maintainer di solito rispondono entro 1 giorno