Issue #2571Opened February 17, 2020by h3llomoto0 reactions

[BUG] Layer visibility btn

Question

If I change the state of the visibility btn - gjs will remove display style and then when I click "show layer" - it won't restore display style. I think it's a bug. Gjs should save current display's options on layer visibility button click to restore it.

Answers (3)

artfFebruary 24, 20200 reactions

I agree 👍

h3llomotoFebruary 24, 20200 reactions

OK guys I found a hotfix for this problem if you need:

        let itmView = editor.LayerManager.getAll();
        itmView.__proto__.toggleVisibility = function(e) {
            e && e.stopPropagation();
            const model = this.model;
            const style = model.getStyle();
            const hidden = style.display == 'none';

            if (hidden) {
                if (model.attributes.oldStyleDisplay) {
                    style.display = model.attributes.oldStyleDisplay;
                    delete model.attributes.oldStyleDisplay;
                } else {
                    delete style.display;
                }
            } else {
                model.attributes.oldStyleDisplay = style.display;
                style.display = 'none';
            }

            model.setStyle(style);
        }
artfMarch 1, 20200 reactions

Thanks @h3llomoto the logic is totally correct, I'll make the same change but a bit more idiomatic

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.