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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Improved zoom handling in CEF4Delphi

Post Reply
User avatar
salvadordf
Posts: 4571
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Improved zoom handling in CEF4Delphi

Post by salvadordf »

Hi,

I just uploaded a new version of CEF4Delphi with improved zoom handling.

These are the changes :
  • Added TChromium.IncZoomPct procedure to increase the zoom percent value.
  • Added TChromium.DecZoomPct procedure to decrease the zoom percent value.
  • Added TChromium.ResetZoomLevel procedure to reset the zoom level value.
  • Added TChromium.ResetZoomPct procedure to reset the zoom percent value.
  • Added TChromium.ReadZoom procedure to trigger the TChromium.OnZoomPctAvailable event with the current zoom percent value.
  • Added TChromium.OnZoomPctAvailable event.
  • Added the new TChromium.OnZoomPctAvailable event to the MiniBrowser demo.
All the TChromium properties and procedures that modify any of the zoom values will execute a task internally to update the value in a CEF thread and it will trigger the TChromium.OnZoomPctAvailable event with the new TChromium.ZoomPct value.

CEF uses the zoom "level" internally but CEF4Delphi translates that value to a percentage property called TChromium.ZoomPct.

CEF4Delphi also has the TChromium.ZoomStep property and the TChromium.IncZoomStep and TChromium.DecZoomStep procedures to modify the zoom percent value in big steps : 25%, 33%, 50%, 67%, 75%, 90%, 100%, 110%, 125%, 150%, 175%, 200%, 250%, 300%, 400% and 500%.

You can also use the TChromium.IncZoomPct and TChromium.DecZoomPct procedures to change the zoom value in 5% steps

All new values set to the TChromium.ZoomPct and TChromium.ZoomLevel properties modify the TChromium.ZoomStep property too but if the zoom value is not one of the previous big steps then it will be set to ZOOM_STEP_UNK (unknown).

The CEF binaries in this version are the same as the previous CEF4Delphi version :
https://www.briskbard.com/forum/viewtop ... f=8&t=1047
Post Reply