Skip to content

Commit d3637b1

Browse files
committed
Adds zoom command line argument [drawio-desktop-1359]
1 parent 261b561 commit d3637b1

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/main/electron.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const codeUrl = url.pathToFileURL(codeDir).href;
4646
// Production app uses asar archive, so we need to go up two more level. It's extra cautious since asar is read-only anyway.
4747
const appBaseDir = path.join(__dirname, __dirname.endsWith(path.join('resources', 'app.asar', 'src', 'main')) ?
4848
'/../../../../' : '/../../');
49+
let appZoom = 1;
4950

5051
//Read config file
5152
var queryObj = {
@@ -372,6 +373,8 @@ app.on('ready', e =>
372373
'selects a page range (for PDF format only)', argsRange)
373374
.option('-u, --uncompressed',
374375
'Uncompressed XML output (for XML format only)')
376+
.option('-z, --zoom <zoom>',
377+
'scales the application interface', parseFloat)
375378
.option('--enable-plugins',
376379
'Enable Plugins')
377380
.parse(argv)
@@ -385,6 +388,11 @@ app.on('ready', e =>
385388
var options = program.opts();
386389
enablePlugins = options.enablePlugins;
387390

391+
if (options.zoom != null)
392+
{
393+
appZoom = options.zoom;
394+
}
395+
388396
//Start export mode?
389397
if (options.export)
390398
{
@@ -755,8 +763,8 @@ app.on('ready', e =>
755763

756764
win.webContents.on('did-finish-load', function()
757765
{
758-
win.webContents.zoomFactor = 1;
759-
win.webContents.setVisualZoomLevelLimits(1, 1);
766+
win.webContents.zoomFactor = appZoom;
767+
win.webContents.setVisualZoomLevelLimits(1, appZoom);
760768
loadFinished();
761769
});
762770
})
@@ -799,8 +807,8 @@ app.on('ready', e =>
799807

800808
firstWinLoaded = true;
801809

802-
win.webContents.zoomFactor = 1;
803-
win.webContents.setVisualZoomLevelLimits(1, 1);
810+
win.webContents.zoomFactor = appZoom;
811+
win.webContents.setVisualZoomLevelLimits(1, appZoom);
804812
loadFinished();
805813
});
806814

@@ -986,8 +994,8 @@ app.on('will-finish-launching', function()
986994

987995
win.webContents.on('did-finish-load', function()
988996
{
989-
win.webContents.zoomFactor = 1;
990-
win.webContents.setVisualZoomLevelLimits(1, 1);
997+
win.webContents.zoomFactor = appZoom;
998+
win.webContents.setVisualZoomLevelLimits(1, appZoom);
991999
loadFinished();
9921000
});
9931001
}

0 commit comments

Comments
 (0)