spotlight icon indicating copy to clipboard operation
spotlight copied to clipboard

Disabling fullscreen not works

Open adaniello opened this issue 4 years ago • 2 comments

If i want hide "fullscreen" icon, eg. via "fullscreen" data attribute by setting it to "false" , i can't.

You can check this issue also in your demo https://nextapps-de.github.io/spotlight/ at the section "Choose Controls (Toolbar)": checkbox not has effect.

Thanks

adaniello avatar Aug 25 '21 16:08 adaniello

Yes, I have same problem. For now, I'm doing this:

.spl-fullscreen {
  display: none !important;
}

mirumirumi avatar Oct 01 '21 02:10 mirumirumi

@ts-thomas

This is happening because the detect_fullscreen function overrides the control option for fullscreen.

Possibly related to #38

Here is the explanation in the code for that function:
https://github.com/nextapps-de/spotlight/blob/5160e7910f4cf27ac9300861ce795821059afba3/src/js/spotlight.js#L650-L652

https://github.com/nextapps-de/spotlight/blob/5160e7910f4cf27ac9300861ce795821059afba3/src/js/spotlight.js#L660-L663

And if I understood it correctly, something like this should fix the problem (?):

function detect_fullscreen(){
    if ((screen.availHeight - window.innerHeight) <= 0) {
        toggleDisplay(maximize, false);
    }
}

However, possibly a more complete solution would be to instead check the fullscreen control option in this function and only proceed if it's not set as hidden. In that case, perhaps something like this is more suitable:

function detect_fullscreen(){
    if (false !== parse_option("fullscreen", controls_default["fullscreen"])) {
        toggleDisplay(maximize, (screen.availHeight - window.innerHeight) > 0);
    }
}

pryley avatar Jan 18 '22 20:01 pryley