Skip to content

Commit 3de406e

Browse files
authored
added zoomFactor
1 parent 24ce69e commit 3de406e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

WebView2/Plugin.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
5151
// Measure constructor
5252
Measure::Measure() : rm(nullptr), skin(nullptr), skinWindow(nullptr),
5353
measureName(nullptr),
54-
width(800), height(600), x(0), y(0),
54+
width(800), height(600), x(0), y(0), zoomFactor(1.0),
5555
visible(true), initialized(false), clickthrough(false), allowDualControl(true), webMessageToken{}
5656
{
5757
// Initialize COM for this thread if not already done
@@ -230,6 +230,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
230230
int newHeight = RmReadInt(rm, L"H", 600);
231231
int newX = RmReadInt(rm, L"X", 0);
232232
int newY = RmReadInt(rm, L"Y", 0);
233+
double newZoomFactor = RmReadFormula(rm, L"ZoomFactor", 1.0);
233234
bool newVisible = RmReadInt(rm, L"Hidden", 0) <= 0;
234235
bool newClickthrough = RmReadInt(rm, L"Clickthrough", 0) >= 1;
235236

@@ -304,13 +305,15 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
304305
bool visibilityChanged = (newVisible != measure->visible);
305306
bool clickthroughChanged = (newClickthrough != measure->clickthrough);
306307
bool allowDualControlChanged = (newAllowDualControl != measure->allowDualControl);
307-
308+
bool zoomFactorChanged = (newZoomFactor != measure->zoomFactor);
309+
308310
// Update stored values
309311
measure->url = newUrl;
310312
measure->width = newWidth;
311313
measure->height = newHeight;
312314
measure->x = newX;
313315
measure->y = newY;
316+
measure->zoomFactor = newZoomFactor;
314317
measure->visible = newVisible;
315318
measure->clickthrough = newClickthrough;
316319
measure->allowDualControl = newAllowDualControl;
@@ -362,6 +365,11 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
362365
{
363366
measure->webViewController->put_IsVisible(measure->visible ? TRUE : FALSE);
364367
}
368+
369+
if (zoomFactorChanged && measure->webViewController)
370+
{
371+
measure->webViewController->put_ZoomFactor(measure->zoomFactor);
372+
}
365373

366374
if (clickthroughChanged)
367375
{

0 commit comments

Comments
 (0)