Blog 2019/4/3
<- previous | index | next ->
By default, the draw.io app will shrink any image larger than 520 pixels wide. This is a problem when creating diagrams which need larger, pixel-perfect images.
If press the Control
key after starting to drag an image, draw.io will sometimes prompt if you'd like to resize or use the original image resolution:
The problem with this is:
- It doesn't consistently present the dialog (sometimes it just shrinks the image anyway)
- The "Remember this setting" appears to be completely broken
- Having to hold
Control
every time to drag in a new image is a pain in the ass!
The easiest way to defeat this "feature" is to use the desktop version of the draw.io app and patch the javascript to disable this behavior.
Download the latest version of the app here: https://github.com/jgraph/drawio-desktop/releases/
Note: because OS X verifies the integrity of applications upon first run, you need to run the app at least once before patching it, otherwise OS X will refuse to run the app:
The file to edit is /Applications/draw.io.app/Contents/Resources/app.asar
In this file will be several copies of EditorUI.js, some of which are minified.
We want to change these constants:
Edit those constants to be a very large number:
Be sure to also edit all instances of those constants in the sections of minified js as well:
(Note: I initially tried to edit app.asar using VS Code, but it ended up blowing up the file by ~6MB (perhaps due to reformatting the minified JS blocks?). I instead edited the file using vim and all was well).
Rather than editing app.asar by hand, you can instead us the binary patch I've attached to this gist.
brew install bsdiff
cat app.asar.bsdiff.base64 | base64 --decode > app.asar.bsdiff
bspatch app.asar app.asar.new app.asar.bsdiff
mv app.asar.new app.asar
Hmm, in some cases it looks like it is still downscaling images anyway. Oh fiddle-sticks!