ol-ext icon indicating copy to clipboard operation
ol-ext copied to clipboard

Print Control - Add custom toggle switches

Open andreaordonselli opened this issue 10 months ago • 3 comments

Good morning, which way do you recommend for adding custom toggle switches in print control?

Image

How is the behavior of the new toggle switch set?

andreaordonselli avatar May 30 '25 09:05 andreaordonselli

It's up to you. Toggle Switch is just ahelper to create checkbox using CSS to encapsulate a checkbox. You can use it as a standard checkbox.

Viglino avatar Jun 02 '25 07:06 Viglino

It is this? https://viglino.github.io/ol-ext/doc/doc-pages/ol.ext.input.Switch.html

How do I use it and how do I add control to print control?                 

andreaordonselli avatar Jun 02 '25 07:06 andreaordonselli

You can use the helper to create a Switch:

var check = ol.ext.element.createSwitch({
    html: 'test',
    className: 'test',
    checked: false,
    on: {
      change: function (e) {
        console.log(e.target.checked)
      }
    },
    parent: printControl.getUserElement()
})

There is a user Element you can use to place more info in the print dialog.

Viglino avatar Jun 02 '25 09:06 Viglino

It works perfectly.
Thank you.

andreaordonselli avatar Nov 04 '25 09:11 andreaordonselli