Page 1 of 1
About ZoomLevel
Posted: Mon Feb 10, 2025 9:45 am
by Alexeich
Hello. Could you please clarify, how to calculate the value to use in the TChromium.ZoomLevel command? The default (100%) is 0. If I want to set 200 % zoom, I should set ZoomValue about 3.8. The 7.6 is ~400%. How to calculate the precise value?
Re: About ZoomLevel
Posted: Mon Feb 10, 2025 11:37 am
by salvadordf
Hi,
The ZoomLevel and ZoomPct properties will only return a valid value if you read them in the CEF UI thread. Calling them in other threads will return 0. ZoomStep however can be read in any thread.
You can write new values of ZoomLevel, ZoomPct or ZoomStep in any thread because TChromiumCore creates a task internally to set the value in the correct thread.
ZoomStep accepts the following values defined in uCEFConstants :
- ZOOM_STEP_25
- ZOOM_STEP_33
- ZOOM_STEP_50
- ZOOM_STEP_67
- ZOOM_STEP_75
- ZOOM_STEP_90
- ZOOM_STEP_100
- ZOOM_STEP_110
- ZOOM_STEP_125
- ZOOM_STEP_150
- ZOOM_STEP_175
- ZOOM_STEP_200
- ZOOM_STEP_250
- ZOOM_STEP_300
- ZOOM_STEP_400
- ZOOM_STEP_500
Those constants can be translated to ZoomPct values with the ZoomStepValues array defined in uCEFConstants.
ZoomPct sets the ZoomLevel value with the following formula :
Code: Select all
ZoomLevel := LogN(1.2, ZoomPct / 100);
See TChromiumCore.doSetZoomStep, TChromiumCore.doSetZoomPct, TChromiumCore.doSetZoomLevel and TChromiumCore.UpdateHostZoomPct.
Re: About ZoomLevel
Posted: Tue Feb 11, 2025 4:06 am
by Alexeich
salvadordf wrote: Mon Feb 10, 2025 11:37 am
Those constants can be translated to ZoomPct values with the ZoomStepValues array defined in uCEFConstants.
See TChromiumCore.doSetZoomStep, TChromiumCore.doSetZoomPct, TChromiumCore.doSetZoomLevel and TChromiumCore.UpdateHostZoomPct.
Oh, now I see, the zoomPct is the zoom percentage, that's what I need to use, not the zoom level!

Thank you!