Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
About ZoomLevel
About ZoomLevel
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?
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: About ZoomLevel
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 :
ZoomPct sets the ZoomLevel value with the following formula :
See TChromiumCore.doSetZoomStep, TChromiumCore.doSetZoomPct, TChromiumCore.doSetZoomLevel and TChromiumCore.UpdateHostZoomPct.
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
ZoomPct sets the ZoomLevel value with the following formula :
Code: Select all
ZoomLevel := LogN(1.2, ZoomPct / 100);
Re: About ZoomLevel
Oh, now I see, the zoomPct is the zoom percentage, that's what I need to use, not the zoom level!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.
